Methods Summary |
---|
public void | afterInitialize(java.lang.Object entity, boolean lazyPropertiesAreUnfetched, org.hibernate.engine.SessionImplementor session)
if ( isInstrumented() ) {
Set lazyProps = lazyPropertiesAreUnfetched && getEntityMetamodel().hasLazyProperties() ?
lazyPropertyNames : null;
//TODO: if we support multiple fetch groups, we would need
// to clone the set of lazy properties!
FieldInterceptionHelper.injectFieldInterceptor( entity, getEntityName(), lazyProps, session );
}
|
protected org.hibernate.tuple.Instantiator | buildInstantiator(org.hibernate.mapping.PersistentClass persistentClass)
if ( optimizer == null ) {
return new PojoInstantiator( persistentClass, null );
}
else {
return new PojoInstantiator( persistentClass, optimizer.getInstantiationOptimizer() );
}
|
protected org.hibernate.property.Getter | buildPropertyGetter(org.hibernate.mapping.Property mappedProperty, org.hibernate.mapping.PersistentClass mappedEntity)
return mappedProperty.getGetter( mappedEntity.getMappedClass() );
|
protected org.hibernate.property.Setter | buildPropertySetter(org.hibernate.mapping.Property mappedProperty, org.hibernate.mapping.PersistentClass mappedEntity)
return mappedProperty.getSetter( mappedEntity.getMappedClass() );
|
protected org.hibernate.proxy.ProxyFactory | buildProxyFactory(org.hibernate.mapping.PersistentClass persistentClass, org.hibernate.property.Getter idGetter, org.hibernate.property.Setter idSetter)
// determine the id getter and setter methods from the proxy interface (if any)
// determine all interfaces needed by the resulting proxy
HashSet proxyInterfaces = new HashSet();
proxyInterfaces.add( HibernateProxy.class );
Class mappedClass = persistentClass.getMappedClass();
Class proxyInterface = persistentClass.getProxyInterface();
if ( proxyInterface!=null && !mappedClass.equals( proxyInterface ) ) {
if ( !proxyInterface.isInterface() ) {
throw new MappingException(
"proxy must be either an interface, or the class itself: " +
getEntityName()
);
}
proxyInterfaces.add( proxyInterface );
}
if ( mappedClass.isInterface() ) {
proxyInterfaces.add( mappedClass );
}
Iterator iter = persistentClass.getSubclassIterator();
while ( iter.hasNext() ) {
Subclass subclass = ( Subclass ) iter.next();
Class subclassProxy = subclass.getProxyInterface();
Class subclassClass = subclass.getMappedClass();
if ( subclassProxy!=null && !subclassClass.equals( subclassProxy ) ) {
if ( !proxyInterface.isInterface() ) {
throw new MappingException(
"proxy must be either an interface, or the class itself: " +
subclass.getEntityName()
);
}
proxyInterfaces.add( subclassProxy );
}
}
Iterator properties = persistentClass.getPropertyIterator();
Class clazz = persistentClass.getMappedClass();
while ( properties.hasNext() ) {
Property property = (Property) properties.next();
Method method = property.getGetter(clazz).getMethod();
if ( method != null && Modifier.isFinal( method.getModifiers() ) ) {
log.error(
"Getters of lazy classes cannot be final: " + persistentClass.getEntityName() +
"." + property.getName()
);
}
method = property.getSetter(clazz).getMethod();
if ( method != null && Modifier.isFinal( method.getModifiers() ) ) {
log.error(
"Setters of lazy classes cannot be final: " + persistentClass.getEntityName() +
"." + property.getName()
);
}
}
Method idGetterMethod = idGetter==null ? null : idGetter.getMethod();
Method idSetterMethod = idSetter==null ? null : idSetter.getMethod();
Method proxyGetIdentifierMethod = idGetterMethod==null || proxyInterface==null ?
null :
ReflectHelper.getMethod(proxyInterface, idGetterMethod);
Method proxySetIdentifierMethod = idSetterMethod==null || proxyInterface==null ?
null :
ReflectHelper.getMethod(proxyInterface, idSetterMethod);
ProxyFactory pf = buildProxyFactoryInternal( persistentClass, idGetter, idSetter );
try {
pf.postInstantiate(
getEntityName(),
mappedClass,
proxyInterfaces,
proxyGetIdentifierMethod,
proxySetIdentifierMethod,
persistentClass.hasEmbeddedIdentifier() ?
(AbstractComponentType) persistentClass.getIdentifier().getType() :
null
);
}
catch ( HibernateException he ) {
log.warn( "could not create proxy factory for:" + getEntityName(), he );
pf = null;
}
return pf;
|
protected org.hibernate.proxy.ProxyFactory | buildProxyFactoryInternal(org.hibernate.mapping.PersistentClass persistentClass, org.hibernate.property.Getter idGetter, org.hibernate.property.Setter idSetter)
// TODO : YUCK!!! finx after HHH-1907 is complete
return Environment.getBytecodeProvider().getProxyFactoryFactory().buildProxyFactory();
// return getFactory().getSettings().getBytecodeProvider().getProxyFactoryFactory().buildProxyFactory();
|
public java.lang.Class | getConcreteProxyClass()
return proxyInterface;
|
public org.hibernate.EntityMode | getEntityMode()
return EntityMode.POJO;
|
public java.lang.Class | getMappedClass()
return mappedClass;
|
public java.lang.Object[] | getPropertyValues(java.lang.Object entity)
if ( shouldGetAllProperties( entity ) && optimizer != null && optimizer.getAccessOptimizer() != null ) {
return getPropertyValuesWithOptimizer( entity );
}
else {
return super.getPropertyValues( entity );
}
|
public java.lang.Object[] | getPropertyValuesToInsert(java.lang.Object entity, java.util.Map mergeMap, org.hibernate.engine.SessionImplementor session)
if ( shouldGetAllProperties( entity ) && optimizer != null && optimizer.getAccessOptimizer() != null ) {
return getPropertyValuesWithOptimizer( entity );
}
else {
return super.getPropertyValuesToInsert( entity, mergeMap, session );
}
|
protected java.lang.Object[] | getPropertyValuesWithOptimizer(java.lang.Object object)
return optimizer.getAccessOptimizer().getPropertyValues( object );
|
public boolean | hasUninitializedLazyProperties(java.lang.Object entity)
if ( getEntityMetamodel().hasLazyProperties() ) {
FieldInterceptor callback = FieldInterceptionHelper.extractFieldInterceptor( entity );
return callback != null && !callback.isInitialized();
}
else {
return false;
}
|
public boolean | isInstrumented()
return FieldInterceptionHelper.isInstrumented( getMappedClass() );
|
public boolean | isLifecycleImplementor()
return lifecycleImplementor;
|
public boolean | isValidatableImplementor()
return validatableImplementor;
|
public void | setPropertyValues(java.lang.Object entity, java.lang.Object[] values)
if ( !getEntityMetamodel().hasLazyProperties() && optimizer != null && optimizer.getAccessOptimizer() != null ) {
setPropertyValuesWithOptimizer( entity, values );
}
else {
super.setPropertyValues( entity, values );
}
|
protected void | setPropertyValuesWithOptimizer(java.lang.Object object, java.lang.Object[] values)
optimizer.getAccessOptimizer().setPropertyValues( object, values );
|