Marco Belladelli (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=637b480...
) *commented* on HHH-16908 (
https://hibernate.atlassian.net/browse/HHH-16908?atlOrigin=eyJpIjoiOWI0OT...
)
Re: Fail to compute column mapping on entity with idClass having one field as pk of a
OneToOne association (
https://hibernate.atlassian.net/browse/HHH-16908?atlOrigin=eyJpIjoiOWI0OT...
)
After discussing this issue with Christian Beikov (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) , we came to the conclusion the the original mapping, though it worked in Hibernate 5,
is not valid. This JPA spec paragraph about Primary Keys Corresponding to Derived
Identities says:
The identity of an entity may be derived from the identity of another
entity (the “parent” entity) when the former entity (the “dependent”
entity) is the owner of a many-to-one or one-to-one relationship to the
parent entity and a foreign key maps the relationship from dependent to
parent.
This is *not* the case for the SpecialProduct primary key, where the wholesalePrice
property is an unowned @OneToOne association (having mappedBy ), thus having no actual
columns on the SPECIAL_PRODUCTS table. The correct behavior should be an explicit error
signaling the mapping problem to the user.
The correct mapping should just exclude the wholesalePrice property from the
SpecialProductPK used as IdClass.
(
https://hibernate.atlassian.net/browse/HHH-16908#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16908#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#100232- sha1:304e1c7 )