Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,18 @@ private void handleNaturalId(Property property) {
+ "' belongs to an entity subclass and may not be annotated '@NaturalId'" +
" (only a property of a root '@Entity' or a '@MappedSuperclass' may be a '@NaturalId')" );
}
if ( memberDetails.hasDirectAnnotationUsage( ManyToOne.class ) ) {
if ( memberDetails.getDirectAnnotationUsage( ManyToOne.class ).fetch() == LAZY ) {
throw new AnnotationException( "Property '" + qualify( holder.getPath(), name )
+ " is annotated '@NaturalId' and '@ManyToOne(fetch=LAZY)' (natural id fields may not be lazy)" );
}
}
if ( memberDetails.hasDirectAnnotationUsage( Basic.class ) ) {
if ( memberDetails.getDirectAnnotationUsage( Basic.class ).fetch() == LAZY ) {
throw new AnnotationException( "Property '" + qualify( holder.getPath(), name )
+ " is annotated '@NaturalId' and '@Basic(fetch=LAZY)' (natural id fields may not be lazy)" );
}
}
if ( !naturalId.mutable() ) {
updatable = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2022,11 +2022,7 @@ private Property createManyToOneAttribute(

Property prop = new Property();
prop.setValue( manyToOneBinding );
bindProperty(
sourceDocument,
manyToOneSource,
prop
);
bindProperty( sourceDocument, manyToOneSource, prop );

if ( isNotEmpty( manyToOneSource.getCascadeStyleName() ) ) {
// todo : would be better to delay this the end of binding (second pass, etc)
Expand Down
Loading