-
-
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
Inconsistent behavior when using @OneToOne with @MapsId #9100
Comments
This issue will be solved when hibernate/hibernate-orm#2755 is merged and released. Hoping that PR to be included in next hibernate release. |
Note: This must also make into v5 maintenance when it is solved. |
@pmverma the issue has been merged in Hibernate-orm master and should be available only in next 5.4.x release. V5 is targetting 5.2.x (SB 2.0.x), and V6 is targetting 5.3.x (SB 2.1.x). |
@DanielFran Yes, it has been merged. Not sure if there is plan to merge in 5.2.x or 5.3.x version. I have asked and have not got reply yet. |
Since the related hibernate fix didn't make into 5.2.x or 5.3.x, we have a few options to still have it(
Important thing to notice here is: AFAIU from Hibernate PR, Hibernate will detect only during merge operation that if the new parent should be set or not. So again, the developer must take care of this when writing the business logic so that wrong association do not effect logic. @DanielFran @jdubois Let me know your opinion. If there is no any special concern then I would like to go with option no. 1. |
@pmverma either 1 or 3 for me. As 1 probably gives less work, and is the one you prefer, let's do it this way. |
Closing this as #9094 has a workaround for it. |
Overview of the issue
I did a PR for adding
@MapsId
support in #8685 . The related raised issue is #7060.However, while writing automated tests #9094 I come to know that if you update the child entity with a new parent then this updated new parent will be used for current transaction.
However, in next request, next time if you load the child then it will refer to its parent which was originally mapped.
Motivation for or Use Case
Child should always refers to its correct parent in any case.
Reproduce the error
Generate a new app with current master
Add following entity.json inside
.jhipster
and regenerate entity withjhipster entity Bar
Launch the application
Create a new Bar using browser and set user
user
Open devtool and go to network tab
Update the Bar to set
admin
Check
PUT
method response body in devtool and u can see the returned bar containsadmin
But any new next request such as listing/view/edit will load the correct
user
Related issues
#7060
#8685
#9094 WIP
Suggest a Fix
JHipster Version(s)
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
java version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)
git version 2.17.2 (Apple Git-113)
node: v10.14.2
npm: 6.4.1
yeoman: 2.0.5
Docker version 18.09.0, build 4d60db4
docker-compose version 1.23.2, build 1110ad01
The text was updated successfully, but these errors were encountered: