Skip to content

Commit

Permalink
HHH-7135 Disallow @mapsid on unowned @OnetoOne
Browse files Browse the repository at this point in the history
  • Loading branch information
beikov committed Jan 13, 2025
1 parent a8e881e commit 4fac597
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,11 @@ private JoinColumn[] getJoinColumnAnnotations(MemberDetails property, PropertyDa
*/
AnnotatedColumns overrideColumnFromMapperOrMapsIdProperty(PropertyData override) {
if ( override != null ) {
final OneToOne oneToOneAnn = override.getAttributeMember().getDirectAnnotationUsage( OneToOne.class );
if ( oneToOneAnn != null && nullIfEmpty( oneToOneAnn.mappedBy() ) != null ) {
throw new AnnotationException( "Property '" + getPath( propertyHolder, override )
+ "' is annotated '@MapsId' but has no columns due to its '@OneToOne(mappedBy)' usage" );
}
final AnnotatedJoinColumns joinColumns = buildExplicitJoinColumns( override.getAttributeMember(), override );
return joinColumns == null
? buildDefaultJoinColumnsForToOne( override.getAttributeMember(), override )
Expand Down

0 comments on commit 4fac597

Please sign in to comment.