-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Project bugs: Liquibase constraint violation with double relations and Tests errors #9563
Comments
Thanks @Gabrui for reporting the issue. The code which you replaced was added for required entity. To reproduce the error, I am not seeing the @Gabrui How did you generated the JDL entity definitions? With |
I used
Done, I have updated the JDL in my comment. |
@Gabrui, I gave a quick try by removing the
|
Yes, the tests fails because of the paginate and filter directives. (It tries to save a unique value twice in the tests) |
Can you create a new issue for that if it is/was not reported so that it can be tracked and fixed? |
I have reported those 2 separated bugs here in this issue. Is it advisable to create another issue to address each of those bugs separately? |
If there's a bug in the JDL parsing/exporting, please create an issue in JHipster-Core for that |
Thanks, I have reported the export bug to the JHipster-Core #319 |
@Gabrui The liquibase error is coming from And yes, it is better to create separate issues so that they can be tracked and fixed independently, keeping clear the matters. |
I just realized that there is another error in the tests, related to a elastic search verification, introduced in #9094, @pmverma The Elastic Search Service is called twice, verify(mock<%= entityClass %>SearchRepository, times(0)).save(<%= asEntity(entityInstance) %>) as the elastic search isn't detached by em.detach(), (so it is updated when the user is changed) and also with the put request.
|
@Gabrui thanks for your comments. Actually the What I do not know is why the automated build passed. I will see that too. |
Overview of the issue
There are two bugs related when I create a new project:
Motivation for or Use Case
Creating a new project with an entity that has filter and pagination creates broken test. Although it is easy to fix the test I didn't expect this error to happen and it may scare new users.
Creating a new project with an entity that has jpaDerivedIdentifier and is referenced by another in a ManyToOne relation.
Reproduce the error
You should created a new project, import the JDL and run the
./mvnw clean install
. The default tests fail because it tries to save the same object twice. (BUG2) This issue is present even in 5.8.2 and 6.0.0-beta0.To reproduce the liquibase error, I did a
./mvnw clean install -Dmaven.test.skip=true
, and then a./mvnw
. This issue is present only in 6.0.0-beta0 and I couldn't figure the cause of it.Suggest a Fix
There isn't any Liquibase error without the jpaDerivedIdentifier. I supposed it is related to the data that was automatically generated and loaded. EDIT: It is the my_entity_complex.csv that references users that doesn't exist (ID 1 up to 10). Replacing the ID larger than 4 solves the problem.
To fix the test error in my code I just did substitute
to
It isn't necessary to persist the entity in this case because the entity is already persisted in the "public static MyEntityComplex createEntity" method. The exception is caused by the unique constraint.
JHipster Version(s)
6.0.0-beta.0 (but the test error also happens on the 5.8.2, the Liquibase error is new)
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.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
git version 2.11.0
node: v10.15.3
npm: 6.4.1
yeoman: 2.0.5
yarn: 1.15.2
Docker version 18.09.5, build e8ff056dbc
docker-compose version 1.24.0, build 0aa59064
Browsers and Operating System
Using Debian 9.8. Generated the project with --yarn.
The text was updated successfully, but these errors were encountered: