From 4531b22e9210416c96848b28ad6ad7450c7fc20f Mon Sep 17 00:00:00 2001 From: Viefhaus Date: Wed, 20 Sep 2017 10:11:08 +0200 Subject: [PATCH] HHH-11986 - @LazyGroup is ignored on LazyToOne association with 'mappedBy' HHH-11986 - Re-format fix code to follow code conventions --- .../main/java/org/hibernate/cfg/OneToOneSecondPass.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/OneToOneSecondPass.java b/hibernate-core/src/main/java/org/hibernate/cfg/OneToOneSecondPass.java index dd07f6ed8a..1859f5586d 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/OneToOneSecondPass.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/OneToOneSecondPass.java @@ -14,6 +14,7 @@ import javax.persistence.ConstraintMode; import org.hibernate.AnnotationException; import org.hibernate.MappingException; import org.hibernate.annotations.ForeignKey; +import org.hibernate.annotations.LazyGroup; import org.hibernate.annotations.common.reflection.XClass; import org.hibernate.boot.spi.MetadataBuildingContext; import org.hibernate.cfg.annotations.PropertyBinder; @@ -102,6 +103,12 @@ public class OneToOneSecondPass implements SecondPass { binder.setValue( value ); binder.setCascade( cascadeStrategy ); binder.setAccessType( inferredData.getDefaultAccess() ); + + final LazyGroup lazyGroupAnnotation = inferredData.getProperty().getAnnotation( LazyGroup.class ); + if ( lazyGroupAnnotation != null ) { + binder.setLazyGroup( lazyGroupAnnotation.value() ); + } + Property prop = binder.makeProperty(); prop.setOptional( optional ); if ( BinderHelper.isEmptyAnnotationValue( mappedBy ) ) {