mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-27 22:39:13 +00:00
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);
|
||||
|
||||
void cacheResolutionFromLoad(
|
||||
Object id, Object naturalId, EntityMappingType entityDescriptor);
|
||||
void cacheResolutionFromLoad(Object id, Object naturalId, EntityMappingType entityDescriptor);
|
||||
|
||||
/**
|
||||
* Ensures that the necessary local cross-reference exists. Specifically, this
|
||||
|
@ -40,15 +40,10 @@ public EntityInstantiatorPojoStandard(
|
||||
PersistentClass persistentClass,
|
||||
JavaType<?> javaType) {
|
||||
super( entityMetamodel, persistentClass, javaType );
|
||||
|
||||
this.entityMetamodel = entityMetamodel;
|
||||
this.proxyInterface = persistentClass.getProxyInterface();
|
||||
|
||||
this.constructor = isAbstract()
|
||||
? null
|
||||
: resolveConstructor( getMappedPojoClass() );
|
||||
|
||||
this.applyBytecodeInterception = isPersistentAttributeInterceptableType( persistentClass.getMappedClass() );
|
||||
proxyInterface = persistentClass.getProxyInterface();
|
||||
constructor = isAbstract() ? null : resolveConstructor( getMappedPojoClass() );
|
||||
applyBytecodeInterception = isPersistentAttributeInterceptableType( persistentClass.getMappedClass() );
|
||||
}
|
||||
|
||||
protected static Constructor<?> resolveConstructor(Class<?> mappedPojoClass) {
|
||||
@ -57,9 +52,8 @@ protected static Constructor<?> resolveConstructor(Class<?> mappedPojoClass) {
|
||||
}
|
||||
catch ( PropertyNotFoundException e ) {
|
||||
LOG.noDefaultConstructor( mappedPojoClass.getName() );
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -69,27 +63,26 @@ public boolean canBeInstantiated() {
|
||||
|
||||
@Override
|
||||
protected Object applyInterception(Object entity) {
|
||||
if ( !applyBytecodeInterception ) {
|
||||
return entity;
|
||||
if ( applyBytecodeInterception ) {
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstance(Object object, SessionFactoryImplementor sessionFactory) {
|
||||
return super.isInstance( object, sessionFactory ) ||
|
||||
//this one needed only for guessEntityMode()
|
||||
( proxyInterface!=null && proxyInterface.isInstance(object) );
|
||||
return super.isInstance( object, sessionFactory )
|
||||
//this one needed only for guessEntityMode()
|
||||
|| proxyInterface != null && proxyInterface.isInstance( object );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user