mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-16 08:05:05 +00:00
HHH-7459 lazyness is not processed correctly
This commit is contained in:
parent
5cd3f85ac5
commit
845c757e07
@ -41,7 +41,7 @@
|
|||||||
/** tuplizer implementation */
|
/** tuplizer implementation */
|
||||||
Class impl();
|
Class impl();
|
||||||
/**
|
/**
|
||||||
* either pojo, dynamic-map or dom4j
|
* either pojo, dynamic-map
|
||||||
* @deprecated should use #entityModeType instead
|
* @deprecated should use #entityModeType instead
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -325,7 +325,7 @@ private Object createProxyIfNecessary(
|
|||||||
}
|
}
|
||||||
return existing;
|
return existing;
|
||||||
}
|
}
|
||||||
LOG.trace( "Creating new proxy for entity" );
|
LOG.trace( "Creating new proxy for entity: " + event.getEntityClassName() );
|
||||||
// return new uninitialized proxy
|
// return new uninitialized proxy
|
||||||
Object proxy = persister.createProxy( event.getEntityId(), event.getSession() );
|
Object proxy = persister.createProxy( event.getEntityId(), event.getSession() );
|
||||||
persistenceContext.getBatchFetchQueue().addBatchLoadableEntityKey( keyToLoad );
|
persistenceContext.getBatchFetchQueue().addBatchLoadableEntityKey( keyToLoad );
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
import org.hibernate.AssertionFailure;
|
import org.hibernate.AssertionFailure;
|
||||||
import org.hibernate.engine.spi.CascadeStyle;
|
import org.hibernate.engine.spi.CascadeStyle;
|
||||||
import org.hibernate.metamodel.internal.source.annotations.attribute.PluralAssociationAttribute;
|
import org.hibernate.metamodel.internal.source.annotations.attribute.PluralAssociationAttribute;
|
||||||
|
import org.hibernate.metamodel.internal.source.annotations.util.EnumConversionHelper;
|
||||||
import org.hibernate.metamodel.spi.source.OneToManyPluralAttributeElementSource;
|
import org.hibernate.metamodel.spi.source.OneToManyPluralAttributeElementSource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,8 +53,7 @@ public boolean isNotFoundAnException() {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<CascadeStyle> getCascadeStyles() {
|
public Iterable<CascadeStyle> getCascadeStyles() {
|
||||||
// TODO
|
return EnumConversionHelper.cascadeTypeToCascadeStyleSet( associationAttribute.getCascadeTypes(), associationAttribute.getContext() );
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -73,6 +73,11 @@ public PluralAttributeElementSource getElementSource() {
|
|||||||
return elementSource;
|
return elementSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMappedBy() {
|
||||||
|
return associationAttribute.getMappedBy();
|
||||||
|
}
|
||||||
|
|
||||||
private PluralAttributeElementSource determineElementSource() {
|
private PluralAttributeElementSource determineElementSource() {
|
||||||
switch ( associationAttribute.getNature() ) {
|
switch ( associationAttribute.getNature() ) {
|
||||||
case MANY_TO_MANY:
|
case MANY_TO_MANY:
|
||||||
|
@ -161,6 +161,11 @@ public FetchStyle getFetchStyle() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUnWrapProxy() {
|
||||||
|
return associationAttribute.isUnWrapProxy();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
@ -37,6 +37,8 @@
|
|||||||
import org.jboss.jandex.DotName;
|
import org.jboss.jandex.DotName;
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.FetchMode;
|
||||||
|
import org.hibernate.annotations.LazyToOneOption;
|
||||||
import org.hibernate.annotations.NotFoundAction;
|
import org.hibernate.annotations.NotFoundAction;
|
||||||
import org.hibernate.engine.FetchStyle;
|
import org.hibernate.engine.FetchStyle;
|
||||||
import org.hibernate.internal.CoreMessageLogger;
|
import org.hibernate.internal.CoreMessageLogger;
|
||||||
@ -69,6 +71,7 @@ public class AssociationAttribute extends MappedAttribute {
|
|||||||
private final Set<CascadeType> cascadeTypes;
|
private final Set<CascadeType> cascadeTypes;
|
||||||
private final boolean isOptional;
|
private final boolean isOptional;
|
||||||
private final boolean isLazy;
|
private final boolean isLazy;
|
||||||
|
private final boolean isUnWrapProxy;
|
||||||
private final boolean isOrphanRemoval;
|
private final boolean isOrphanRemoval;
|
||||||
private final FetchStyle fetchStyle;
|
private final FetchStyle fetchStyle;
|
||||||
private final boolean mapsId;
|
private final boolean mapsId;
|
||||||
@ -116,6 +119,7 @@ public static AssociationAttribute createAssociationAttribute(
|
|||||||
this.mappedBy = determineMappedByAttributeName( associationAnnotation );
|
this.mappedBy = determineMappedByAttributeName( associationAnnotation );
|
||||||
this.isOptional = determineOptionality( associationAnnotation );
|
this.isOptional = determineOptionality( associationAnnotation );
|
||||||
this.isLazy = determineIsLazy( associationAnnotation );
|
this.isLazy = determineIsLazy( associationAnnotation );
|
||||||
|
this.isUnWrapProxy = determinIsUnwrapProxy();
|
||||||
this.isOrphanRemoval = determineOrphanRemoval( associationAnnotation );
|
this.isOrphanRemoval = determineOrphanRemoval( associationAnnotation );
|
||||||
this.cascadeTypes = determineCascadeTypes( associationAnnotation );
|
this.cascadeTypes = determineCascadeTypes( associationAnnotation );
|
||||||
this.joinColumnValues = determineJoinColumnAnnotations( annotations );
|
this.joinColumnValues = determineJoinColumnAnnotations( annotations );
|
||||||
@ -180,6 +184,10 @@ public boolean isLazy() {
|
|||||||
return isLazy;
|
return isLazy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isUnWrapProxy() {
|
||||||
|
return isUnWrapProxy;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOptional() {
|
public boolean isOptional() {
|
||||||
return isOptional;
|
return isOptional;
|
||||||
@ -238,6 +246,14 @@ private boolean determineNotFoundBehavior() {
|
|||||||
return NotFoundAction.IGNORE.equals( action );
|
return NotFoundAction.IGNORE.equals( action );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean determinIsUnwrapProxy() {
|
||||||
|
AnnotationInstance lazyToOne = JandexHelper.getSingleAnnotation( annotations(), HibernateDotNames.LAZY_TO_ONE );
|
||||||
|
if ( lazyToOne != null ) {
|
||||||
|
return JandexHelper.getEnumValue( lazyToOne, "value", LazyToOneOption.class ) == LazyToOneOption.NO_PROXY;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean determineOptionality(AnnotationInstance associationAnnotation) {
|
private boolean determineOptionality(AnnotationInstance associationAnnotation) {
|
||||||
boolean optional = true;
|
boolean optional = true;
|
||||||
|
|
||||||
@ -260,7 +276,30 @@ private boolean determineOrphanRemoval(AnnotationInstance associationAnnotation)
|
|||||||
|
|
||||||
protected boolean determineIsLazy(AnnotationInstance associationAnnotation) {
|
protected boolean determineIsLazy(AnnotationInstance associationAnnotation) {
|
||||||
FetchType fetchType = JandexHelper.getEnumValue( associationAnnotation, "fetch", FetchType.class );
|
FetchType fetchType = JandexHelper.getEnumValue( associationAnnotation, "fetch", FetchType.class );
|
||||||
return FetchType.LAZY == fetchType;
|
boolean lazy = fetchType == FetchType.LAZY;
|
||||||
|
final AnnotationInstance lazyToOneAnnotation = JandexHelper.getSingleAnnotation(
|
||||||
|
annotations(),
|
||||||
|
HibernateDotNames.LAZY_TO_ONE
|
||||||
|
);
|
||||||
|
if ( lazyToOneAnnotation != null ) {
|
||||||
|
LazyToOneOption option = JandexHelper.getEnumValue( lazyToOneAnnotation, "value", LazyToOneOption.class );
|
||||||
|
lazy = option != LazyToOneOption.FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( associationAnnotation.value( "fetch" ) != null ) {
|
||||||
|
lazy = FetchType.LAZY == fetchType;
|
||||||
|
}
|
||||||
|
final AnnotationInstance fetchAnnotation = JandexHelper.getSingleAnnotation(
|
||||||
|
annotations(),
|
||||||
|
HibernateDotNames.FETCH
|
||||||
|
);
|
||||||
|
if ( fetchAnnotation != null ) {
|
||||||
|
lazy = JandexHelper.getEnumValue( fetchAnnotation, "value", FetchMode.class ) != FetchMode.JOIN;
|
||||||
|
}
|
||||||
|
if ( getFetchStyle() != null ) {
|
||||||
|
lazy = getFetchStyle() != FetchStyle.JOIN;
|
||||||
|
}
|
||||||
|
return lazy;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String determineReferencedEntityType(AnnotationInstance associationAnnotation, Class<?> referencedAttributeType) {
|
private String determineReferencedEntityType(AnnotationInstance associationAnnotation, Class<?> referencedAttributeType) {
|
||||||
|
@ -26,12 +26,15 @@
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.persistence.FetchType;
|
||||||
|
|
||||||
import org.jboss.jandex.AnnotationInstance;
|
import org.jboss.jandex.AnnotationInstance;
|
||||||
import org.jboss.jandex.ClassInfo;
|
import org.jboss.jandex.ClassInfo;
|
||||||
import org.jboss.jandex.DotName;
|
import org.jboss.jandex.DotName;
|
||||||
|
|
||||||
import org.hibernate.AnnotationException;
|
import org.hibernate.AnnotationException;
|
||||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||||
|
import org.hibernate.annotations.FetchMode;
|
||||||
import org.hibernate.annotations.LazyCollectionOption;
|
import org.hibernate.annotations.LazyCollectionOption;
|
||||||
import org.hibernate.annotations.OnDeleteAction;
|
import org.hibernate.annotations.OnDeleteAction;
|
||||||
import org.hibernate.annotations.SortType;
|
import org.hibernate.annotations.SortType;
|
||||||
@ -231,7 +234,10 @@ HibernateDotNames.SQL_DELETE_ALL, annotations()
|
|||||||
AnnotationInstance orderColumnAnnotation = JandexHelper.getSingleAnnotation( annotations, JPADotNames.ORDER_COLUMN );
|
AnnotationInstance orderColumnAnnotation = JandexHelper.getSingleAnnotation( annotations, JPADotNames.ORDER_COLUMN );
|
||||||
AnnotationInstance indexColumnAnnotation = JandexHelper.getSingleAnnotation( annotations, HibernateDotNames.INDEX_COLUMN );
|
AnnotationInstance indexColumnAnnotation = JandexHelper.getSingleAnnotation( annotations, HibernateDotNames.INDEX_COLUMN );
|
||||||
if ( orderColumnAnnotation != null && indexColumnAnnotation != null ) {
|
if ( orderColumnAnnotation != null && indexColumnAnnotation != null ) {
|
||||||
throw new MappingException( "@OrderColumn and @IndexColumn can't be used together on property: " + getRole() ,getContext().getOrigin() );
|
throw new MappingException(
|
||||||
|
"@OrderColumn and @IndexColumn can't be used together on property: " + getRole(),
|
||||||
|
getContext().getOrigin()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
this.isIndexed = orderColumnAnnotation != null || indexColumnAnnotation != null;
|
this.isIndexed = orderColumnAnnotation != null || indexColumnAnnotation != null;
|
||||||
|
|
||||||
@ -276,9 +282,11 @@ private String determineCustomPersister() {
|
|||||||
}
|
}
|
||||||
return entityPersisterClass;
|
return entityPersisterClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean determineIsLazy(AnnotationInstance associationAnnotation) {
|
protected boolean determineIsLazy(AnnotationInstance associationAnnotation) {
|
||||||
boolean lazy = super.determineIsLazy( associationAnnotation );
|
FetchType fetchType = JandexHelper.getEnumValue( associationAnnotation, "fetch", FetchType.class );
|
||||||
|
boolean lazy = fetchType == FetchType.LAZY;
|
||||||
final AnnotationInstance lazyCollectionAnnotationInstance = JandexHelper.getSingleAnnotation(
|
final AnnotationInstance lazyCollectionAnnotationInstance = JandexHelper.getSingleAnnotation(
|
||||||
annotations(),
|
annotations(),
|
||||||
HibernateDotNames.LAZY_COLLECTION
|
HibernateDotNames.LAZY_COLLECTION
|
||||||
@ -289,9 +297,19 @@ protected boolean determineIsLazy(AnnotationInstance associationAnnotation) {
|
|||||||
"value",
|
"value",
|
||||||
LazyCollectionOption.class
|
LazyCollectionOption.class
|
||||||
);
|
);
|
||||||
return lazyOption == LazyCollectionOption.TRUE;
|
lazy = !( lazyOption == LazyCollectionOption.FALSE );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
final AnnotationInstance fetchAnnotation = JandexHelper.getSingleAnnotation(
|
||||||
|
annotations(),
|
||||||
|
HibernateDotNames.FETCH
|
||||||
|
);
|
||||||
|
if ( fetchAnnotation != null && fetchAnnotation.value() != null ) {
|
||||||
|
FetchMode fetchMode = FetchMode.valueOf( fetchAnnotation.value( ).asEnum().toUpperCase() );
|
||||||
|
if ( fetchMode == FetchMode.JOIN ) {
|
||||||
|
lazy = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
return lazy;
|
return lazy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
import org.hibernate.EntityMode;
|
import org.hibernate.EntityMode;
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.internal.CoreMessageLogger;
|
import org.hibernate.internal.CoreMessageLogger;
|
||||||
|
import org.hibernate.internal.util.StringHelper;
|
||||||
import org.hibernate.metamodel.internal.source.annotations.AnnotationBindingContext;
|
import org.hibernate.metamodel.internal.source.annotations.AnnotationBindingContext;
|
||||||
import org.hibernate.metamodel.internal.source.annotations.attribute.AssociationAttribute;
|
import org.hibernate.metamodel.internal.source.annotations.attribute.AssociationAttribute;
|
||||||
import org.hibernate.metamodel.internal.source.annotations.attribute.AttributeOverride;
|
import org.hibernate.metamodel.internal.source.annotations.attribute.AttributeOverride;
|
||||||
@ -526,10 +527,10 @@ private void resolveEmbeddable(String attributeName, Class<?> type, Map<DotName,
|
|||||||
if ( embeddableClassInfo == null ) {
|
if ( embeddableClassInfo == null ) {
|
||||||
final String msg = String.format(
|
final String msg = String.format(
|
||||||
"Attribute '%s#%s' is annotated with @Embedded, but '%s' does not seem to be annotated " +
|
"Attribute '%s#%s' is annotated with @Embedded, but '%s' does not seem to be annotated " +
|
||||||
"with @Embeddable. Are all annotated classes added to the configuration?",
|
"with @Embeddable.\n Are all annotated classes added to the configuration?",
|
||||||
getConfiguredClass().getSimpleName(),
|
getConfiguredClass().getName(),
|
||||||
attributeName,
|
attributeName,
|
||||||
type.getSimpleName()
|
type.getName()
|
||||||
);
|
);
|
||||||
throw new AnnotationException( msg );
|
throw new AnnotationException( msg );
|
||||||
}
|
}
|
||||||
@ -669,6 +670,9 @@ private ResolvedMember findResolvedMember(String name, ResolvedMember[] resolved
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Class<?> resolveCollectionValuedReferenceType(ResolvedMember resolvedMember) {
|
private Class<?> resolveCollectionValuedReferenceType(ResolvedMember resolvedMember) {
|
||||||
|
if ( resolvedMember.getType().isArray() ) {
|
||||||
|
return resolvedMember.getType().getArrayElementType().getErasedType();
|
||||||
|
}
|
||||||
if ( resolvedMember.getType().getTypeParameters().isEmpty() ) {
|
if ( resolvedMember.getType().getTypeParameters().isEmpty() ) {
|
||||||
return null; // no generic at all
|
return null; // no generic at all
|
||||||
}
|
}
|
||||||
@ -752,28 +756,44 @@ private String determineCustomTuplizer() {
|
|||||||
final AnnotationInstance tuplizersAnnotation = JandexHelper.getSingleAnnotation(
|
final AnnotationInstance tuplizersAnnotation = JandexHelper.getSingleAnnotation(
|
||||||
classInfo, HibernateDotNames.TUPLIZERS
|
classInfo, HibernateDotNames.TUPLIZERS
|
||||||
);
|
);
|
||||||
if ( tuplizersAnnotation == null ) {
|
final AnnotationInstance tuplizerAnnotation = JandexHelper.getSingleAnnotation(
|
||||||
return null;
|
classInfo,
|
||||||
}
|
HibernateDotNames.TUPLIZER
|
||||||
|
);
|
||||||
|
if ( tuplizersAnnotation != null ) {
|
||||||
AnnotationInstance[] annotations = JandexHelper.getValue(
|
AnnotationInstance[] annotations = JandexHelper.getValue(
|
||||||
tuplizersAnnotation,
|
tuplizersAnnotation,
|
||||||
"value",
|
"value",
|
||||||
AnnotationInstance[].class
|
AnnotationInstance[].class
|
||||||
);
|
);
|
||||||
|
for ( final AnnotationInstance annotationInstance : annotations ) {
|
||||||
AnnotationInstance pojoTuplizerAnnotation = null;
|
final String impl = findTuplizerImpl( annotationInstance );
|
||||||
for ( AnnotationInstance tuplizerAnnotation : annotations ) {
|
if ( StringHelper.isNotEmpty( impl ) ) {
|
||||||
if ( EntityMode.valueOf( tuplizerAnnotation.value( "entityModeType" ).asEnum() ) == EntityMode.POJO ) {
|
return impl;
|
||||||
pojoTuplizerAnnotation = tuplizerAnnotation;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if ( tuplizerAnnotation != null ) {
|
||||||
|
final String impl = findTuplizerImpl( tuplizerAnnotation );
|
||||||
|
if ( StringHelper.isNotEmpty( impl ) ) {
|
||||||
|
return impl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
String customTuplizer = null;
|
private String findTuplizerImpl(final AnnotationInstance tuplizerAnnotation) {
|
||||||
if ( pojoTuplizerAnnotation != null ) {
|
EntityMode mode;
|
||||||
customTuplizer = pojoTuplizerAnnotation.value( "impl" ).asString();
|
if ( tuplizerAnnotation.value( "entityModeType" ) != null ) {
|
||||||
|
mode = EntityMode.valueOf( tuplizerAnnotation.value( "entityModeType" ).asEnum() );
|
||||||
}
|
}
|
||||||
return customTuplizer;
|
else if ( tuplizerAnnotation.value( "entityMode" ) != null ) {
|
||||||
|
mode = EntityMode.parse( tuplizerAnnotation.value( "entityMode" ).asString() );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mode = EntityMode.POJO;
|
||||||
|
}
|
||||||
|
return mode == EntityMode.POJO ? tuplizerAnnotation.value( "impl" ).asString() : null;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ public class EntityClass extends ConfiguredClass {
|
|||||||
private final List<String> synchronizedTableNames;
|
private final List<String> synchronizedTableNames;
|
||||||
private final int batchSize;
|
private final int batchSize;
|
||||||
|
|
||||||
private boolean isMutable;
|
private boolean isImmutable;
|
||||||
private boolean isExplicitPolymorphism;
|
private boolean isExplicitPolymorphism;
|
||||||
private OptimisticLockStyle optimisticLockStyle;
|
private OptimisticLockStyle optimisticLockStyle;
|
||||||
private String whereClause;
|
private String whereClause;
|
||||||
@ -152,7 +152,7 @@ public boolean isExplicitPolymorphism() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMutable() {
|
public boolean isMutable() {
|
||||||
return isMutable;
|
return !isImmutable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OptimisticLockStyle getOptimisticLockStyle() {
|
public OptimisticLockStyle getOptimisticLockStyle() {
|
||||||
@ -287,11 +287,16 @@ private void processHibernateEntitySpecificAnnotations() {
|
|||||||
optimisticLockStyle = OptimisticLockStyle.valueOf( optimisticLockType.name() );
|
optimisticLockStyle = OptimisticLockStyle.valueOf( optimisticLockType.name() );
|
||||||
|
|
||||||
AnnotationInstance hibernateImmutableAnnotation = JandexHelper.getSingleAnnotation( getClassInfo(), HibernateDotNames.IMMUTABLE, ClassInfo.class );
|
AnnotationInstance hibernateImmutableAnnotation = JandexHelper.getSingleAnnotation( getClassInfo(), HibernateDotNames.IMMUTABLE, ClassInfo.class );
|
||||||
isMutable = hibernateImmutableAnnotation == null
|
if ( hibernateImmutableAnnotation != null ) {
|
||||||
&& hibernateEntityAnnotation != null
|
isImmutable = true;
|
||||||
&& hibernateEntityAnnotation.value( "mutable" ) != null
|
}
|
||||||
&& hibernateEntityAnnotation.value( "mutable" ).asBoolean();
|
else if (hibernateEntityAnnotation != null
|
||||||
|
&& hibernateEntityAnnotation.value( "mutable" ) != null){
|
||||||
|
|
||||||
|
isImmutable = !hibernateEntityAnnotation.value( "mutable" ).asBoolean();
|
||||||
|
} else {
|
||||||
|
isImmutable = false;
|
||||||
|
}
|
||||||
|
|
||||||
final AnnotationInstance whereAnnotation = JandexHelper.getSingleAnnotation(
|
final AnnotationInstance whereAnnotation = JandexHelper.getSingleAnnotation(
|
||||||
getClassInfo(), HibernateDotNames.WHERE
|
getClassInfo(), HibernateDotNames.WHERE
|
||||||
|
@ -127,6 +127,14 @@ public boolean isLazy() {
|
|||||||
return getFetchTiming() != FetchTiming.IMMEDIATE;
|
return getFetchTiming() != FetchTiming.IMMEDIATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUnWrapProxy() {
|
||||||
|
final String lazySelection = manyToOneElement.getLazy() != null
|
||||||
|
? manyToOneElement.getLazy().value()
|
||||||
|
: null;
|
||||||
|
return lazySelection != null && lazySelection.equals( "no-proxy" );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SingularAttributeBinding.NaturalIdMutability getNaturalIdMutability() {
|
public SingularAttributeBinding.NaturalIdMutability getNaturalIdMutability() {
|
||||||
return naturalIdMutability;
|
return naturalIdMutability;
|
||||||
|
@ -53,7 +53,7 @@ public class ManyToOneAttributeBinding
|
|||||||
private CascadeStyle cascadeStyle;
|
private CascadeStyle cascadeStyle;
|
||||||
private FetchTiming fetchTiming;
|
private FetchTiming fetchTiming;
|
||||||
private FetchStyle fetchStyle;
|
private FetchStyle fetchStyle;
|
||||||
|
private boolean isUnWrapProxy;
|
||||||
public ManyToOneAttributeBinding(
|
public ManyToOneAttributeBinding(
|
||||||
AttributeBindingContainer container,
|
AttributeBindingContainer container,
|
||||||
SingularAttribute attribute,
|
SingularAttribute attribute,
|
||||||
@ -180,6 +180,14 @@ public FetchMode getFetchMode() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isUnWrapProxy() {
|
||||||
|
return isUnWrapProxy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUnWrapProxy(boolean unWrapProxy) {
|
||||||
|
isUnWrapProxy = unWrapProxy;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final EntityBinding getReferencedEntityBinding() {
|
public final EntityBinding getReferencedEntityBinding() {
|
||||||
return referencedEntityBinding;
|
return referencedEntityBinding;
|
||||||
|
@ -41,4 +41,6 @@ public interface SingularAssociationAttributeBinding extends SingularAttributeBi
|
|||||||
public EntityBinding getReferencedEntityBinding();
|
public EntityBinding getReferencedEntityBinding();
|
||||||
|
|
||||||
public SingularAttributeBinding getReferencedAttributeBinding();
|
public SingularAttributeBinding getReferencedAttributeBinding();
|
||||||
|
public boolean isUnWrapProxy();
|
||||||
|
public void setUnWrapProxy(boolean unWrapProxy);
|
||||||
}
|
}
|
@ -43,6 +43,6 @@ public interface ToOneAttributeSource
|
|||||||
* @return The name of the referenced entity
|
* @return The name of the referenced entity
|
||||||
*/
|
*/
|
||||||
public String getReferencedEntityName();
|
public String getReferencedEntityName();
|
||||||
|
public boolean isUnWrapProxy();
|
||||||
public List<Binder.DefaultNamingStrategy> getDefaultNamingStrategies(final String entityName, final String tableName, final AttributeBinding referencedAttributeBinding);
|
public List<Binder.DefaultNamingStrategy> getDefaultNamingStrategies(final String entityName, final String tableName, final AttributeBinding referencedAttributeBinding);
|
||||||
}
|
}
|
||||||
|
@ -250,16 +250,25 @@ private <T extends Annotation> T getAnnotation(Annotation[] annotations, Class<T
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String objectToSQLString(Object value) {
|
public String objectToSQLString(Object value) {
|
||||||
|
if(enumValueMapper==null){
|
||||||
|
guessTypeOfEnumValueMapper( sqlType );
|
||||||
|
}
|
||||||
return enumValueMapper.objectToSQLString( (Enum) value );
|
return enumValueMapper.objectToSQLString( (Enum) value );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXMLString(Object value) {
|
public String toXMLString(Object value) {
|
||||||
|
if(enumValueMapper==null){
|
||||||
|
guessTypeOfEnumValueMapper( sqlType );
|
||||||
|
}
|
||||||
return enumValueMapper.toXMLString( (Enum) value );
|
return enumValueMapper.toXMLString( (Enum) value );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object fromXMLString(String xmlValue) {
|
public Object fromXMLString(String xmlValue) {
|
||||||
|
if(enumValueMapper==null){
|
||||||
|
guessTypeOfEnumValueMapper( sqlType );
|
||||||
|
}
|
||||||
return enumValueMapper.fromXMLString( xmlValue );
|
return enumValueMapper.fromXMLString( xmlValue );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user