Yoann Rodière (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYTJhN2RjNmYz...
) / New Feature (
https://hibernate.atlassian.net/browse/HHH-15508?atlOrigin=eyJpIjoiYTJhN2...
) HHH-15508 (
https://hibernate.atlassian.net/browse/HHH-15508?atlOrigin=eyJpIjoiYTJhN2...
) Backport Session#getReference to branch 5.6 (
https://hibernate.atlassian.net/browse/HHH-15508?atlOrigin=eyJpIjoiYTJhN2...
)
Issue Type: New Feature Assignee: Yoann Rodière (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) Components: hibernate-core Created: 14/Sep/2022 02:35 AM Fix Versions: 5.6-backlog
Priority: Major Reporter: Yoann Rodière (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
See
https://hibernate.zulipchat.com/#narrow/stream/132094-hibernate-orm-dev/t...
(
https://hibernate.zulipchat.com/#narrow/stream/132094-hibernate-orm-dev/t...
)
[ getReference(Object) is] the only way to safely get an attached instance
of a detached entity without merging it. Critically, it's hard to get the
ID of a detached entity in a completely safe way. Session#getIdentifier doesn't
work on detached entities, and {{PersistenceUnitUtil#getIdentifier}}won't
work on detached entities whose ID contains an association.
In this case I think the patch would be limited to adding one method to Session
, and that method wouldn't even be an overload (since there's no getReference
method with one parameter), so the [backporting] seems pretty safe.
(
https://hibernate.atlassian.net/browse/HHH-15508#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-15508#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100207- sha1:c85b1ee )