Closed ksilz closed 5 years ago
Got a similar problem with the dropdown menus in One-To-Many-Relationships. Empty \<option>-Tags are created in the single-\<select> for the related entities but no actual attribute (like id or name) is displayed.
The issue is comming from the entity definition, and particularly the use of required.
For instance, for the one-to-one relationship between Shipment and ShipmentOrder, you make the relationship required from both side. I guess there could be some use cases where that can be useful, but the logic depend on your business, and cannot be automated, IMO. Same for one-to-many relationship with required on both sides.
For the moment, what is generated is (for the one-to-one relationship, but the logic is the same for the others):
What you did is deleting this check : that lead to deleting the required rule on the ShoppingOrder side
Hello @clement26695! Thank you for your comments!
I agree with you - having a two-sided relationship required on both ends is not very useful, I need to think about why I did this some more.
But from what I could see, your pull request only fixes one bug I reported here — the one with the "left-over check". It seems the other one still stands:
<select>
, such as order
instead of orderId
. See here, lines 29-41, for an example.How will that be fixed?
I didn't test yet, but I think #9768 fixed the rest of it. Could you test to see if it solved your issue ? Otherwise, I'll test it tomorrow
I updated the PR. It should be good now
@clement26695 I'm testing it with the latest version of the jHipster main branch.
@clement26695 I wasn't able to test with the latest jHipster main branch. I think I got the dev version of the jHipster generator and the Java library project installed correctly. But then the generated entities wouldn't work, so I gave up. :-(
Overview of the issue
jHipster 6.0.1 with Angular, Java 11, and H2/PostgreSQL produces two kind of errors for "OneToMany / ManyToOne relationships":
<select>
, such asorder
instead oforderId
. See here, lines 29-41, for an example.<select>
, only some error display snippets. See here, lines 132-137, as an example.Motivation for or Use Case
My data model, expressed in the JDL, works. The generated code doesn't.
Reproduce the error
src/main/resources/config/liquibase/data/
directory, replace these three files to fix #9721:product-update.component.html
fails and stops Angular from completing the screen.address-update.component.html
haseditForm.get('user')
instead ofeditForm.get('userId')
in lines 84-89.Related issues
9721 needs to be fixed first before you can get to this issue.
Suggest a Fix
I fixed this on the
update-forms-fixed
branch of the sample GitHub repository. See the link for the changes in these files:address-update.component.html
product-order-update.component.html
product-update.component.html
shipment-update.component.html
shopping-order-update.component.html
JHipster Version(s)
6.0.1
JHipster configuration
JHipster Version(s)
JHipster configuration, a
.yo-rc.json
file generated in the root folder.yo-rc.json file
JDL for the Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryJDL entity definitions
Environment and Tools
openjdk version "11.0.3" 2019-04-16 OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.3+7) OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.3+7, mixed mode)
git version 2.21.0
node: v10.15.3
npm: 6.9.0
Docker version 18.09.2, build 6247962
docker-compose version 1.23.2, build 1110ad01
Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryAddress.json
Product.json
ProductOrder.json
Shipment.json
ShoppingOrder.json
Browsers and Operating System
macOS 10.14.5, all browsers