some cleanups to AbstractEntityInitializer
it had some really long methods
This commit is contained in:
parent
608e4ef6d6
commit
b1e2eca53e
|
@ -36,8 +36,7 @@ public interface NaturalIdResolutions {
|
||||||
*/
|
*/
|
||||||
Object removeResolution(Object id, Object naturalId, EntityMappingType entityDescriptor);
|
Object removeResolution(Object id, Object naturalId, EntityMappingType entityDescriptor);
|
||||||
|
|
||||||
void cacheResolutionFromLoad(
|
void cacheResolutionFromLoad(Object id, Object naturalId, EntityMappingType entityDescriptor);
|
||||||
Object id, Object naturalId, EntityMappingType entityDescriptor);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensures that the necessary local cross-reference exists. Specifically, this
|
* Ensures that the necessary local cross-reference exists. Specifically, this
|
||||||
|
|
|
@ -40,15 +40,10 @@ public class EntityInstantiatorPojoStandard extends AbstractEntityInstantiatorPo
|
||||||
PersistentClass persistentClass,
|
PersistentClass persistentClass,
|
||||||
JavaType<?> javaType) {
|
JavaType<?> javaType) {
|
||||||
super( entityMetamodel, persistentClass, javaType );
|
super( entityMetamodel, persistentClass, javaType );
|
||||||
|
|
||||||
this.entityMetamodel = entityMetamodel;
|
this.entityMetamodel = entityMetamodel;
|
||||||
this.proxyInterface = persistentClass.getProxyInterface();
|
proxyInterface = persistentClass.getProxyInterface();
|
||||||
|
constructor = isAbstract() ? null : resolveConstructor( getMappedPojoClass() );
|
||||||
this.constructor = isAbstract()
|
applyBytecodeInterception = isPersistentAttributeInterceptableType( persistentClass.getMappedClass() );
|
||||||
? null
|
|
||||||
: resolveConstructor( getMappedPojoClass() );
|
|
||||||
|
|
||||||
this.applyBytecodeInterception = isPersistentAttributeInterceptableType( persistentClass.getMappedClass() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static Constructor<?> resolveConstructor(Class<?> mappedPojoClass) {
|
protected static Constructor<?> resolveConstructor(Class<?> mappedPojoClass) {
|
||||||
|
@ -57,9 +52,8 @@ public class EntityInstantiatorPojoStandard extends AbstractEntityInstantiatorPo
|
||||||
}
|
}
|
||||||
catch ( PropertyNotFoundException e ) {
|
catch ( PropertyNotFoundException e ) {
|
||||||
LOG.noDefaultConstructor( mappedPojoClass.getName() );
|
LOG.noDefaultConstructor( mappedPojoClass.getName() );
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -69,27 +63,26 @@ public class EntityInstantiatorPojoStandard extends AbstractEntityInstantiatorPo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object applyInterception(Object entity) {
|
protected Object applyInterception(Object entity) {
|
||||||
if ( !applyBytecodeInterception ) {
|
if ( applyBytecodeInterception ) {
|
||||||
return entity;
|
asPersistentAttributeInterceptable( entity )
|
||||||
|
.$$_hibernate_setInterceptor( new LazyAttributeLoadingInterceptor(
|
||||||
|
entityMetamodel.getName(),
|
||||||
|
null,
|
||||||
|
entityMetamodel.getBytecodeEnhancementMetadata()
|
||||||
|
.getLazyAttributesMetadata()
|
||||||
|
.getLazyAttributeNames(),
|
||||||
|
null
|
||||||
|
) );
|
||||||
}
|
}
|
||||||
|
|
||||||
PersistentAttributeInterceptor interceptor = new LazyAttributeLoadingInterceptor(
|
|
||||||
entityMetamodel.getName(),
|
|
||||||
null,
|
|
||||||
entityMetamodel.getBytecodeEnhancementMetadata()
|
|
||||||
.getLazyAttributesMetadata()
|
|
||||||
.getLazyAttributeNames(),
|
|
||||||
null
|
|
||||||
);
|
|
||||||
asPersistentAttributeInterceptable( entity ).$$_hibernate_setInterceptor( interceptor );
|
|
||||||
return entity;
|
return entity;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInstance(Object object, SessionFactoryImplementor sessionFactory) {
|
public boolean isInstance(Object object, SessionFactoryImplementor sessionFactory) {
|
||||||
return super.isInstance( object, sessionFactory ) ||
|
return super.isInstance( object, sessionFactory )
|
||||||
//this one needed only for guessEntityMode()
|
//this one needed only for guessEntityMode()
|
||||||
( proxyInterface!=null && proxyInterface.isInstance(object) );
|
|| proxyInterface != null && proxyInterface.isInstance( object );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue