org.hibernate.tuple.entity

Class PojoEntityTuplizer

Implemented Interfaces:
EntityTuplizer, Tuplizer

public class PojoEntityTuplizer
extends AbstractEntityTuplizer

An EntityTuplizer specific to the pojo entity mode.
Authors:
Steve Ebersole
Gavin King

Field Summary

Fields inherited from class org.hibernate.tuple.entity.AbstractEntityTuplizer

getters, hasCustomAccessors, propertySpan, setters

Constructor Summary

PojoEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity)

Method Summary

void
afterInitialize(Object entity, boolean lazyPropertiesAreUnfetched, SessionImplementor session)
Called just after the entities properties have been initialized.
protected Instantiator
buildInstantiator(PersistentClass persistentClass)
protected Getter
buildPropertyGetter(Property mappedProperty, PersistentClass mappedEntity)
protected Setter
buildPropertySetter(Property mappedProperty, PersistentClass mappedEntity)
protected ProxyFactory
buildProxyFactory(PersistentClass persistentClass, Getter idGetter, Setter idSetter)
protected ProxyFactory
buildProxyFactoryInternal(PersistentClass persistentClass, Getter idGetter, Setter idSetter)
Class
getConcreteProxyClass()
Returns the java class to which generated proxies will be typed.
EntityMode
getEntityMode()
Class
getMappedClass()
Return the pojo class managed by this tuplizer.
Object[]
getPropertyValues(Object entity)
Extract the current values contained on the given entity.
Object[]
getPropertyValuesToInsert(Object entity, Map mergeMap, SessionImplementor session)
Extract the values of the insertable properties of the entity (including backrefs)
protected Object[]
getPropertyValuesWithOptimizer(Object object)
boolean
hasUninitializedLazyProperties(Object entity)
Does the given entity instance have any currently uninitialized lazy properties?
boolean
isInstrumented()
Is it an instrumented POJO?
boolean
isLifecycleImplementor()
Does the class managed by this tuplizer implement the Lifecycle interface.
boolean
isValidatableImplementor()
Does the class managed by this tuplizer implement the Validatable interface.
void
setPropertyValues(Object entity, Object[] values)
Inject the given values into the given entity.
protected void
setPropertyValuesWithOptimizer(Object object, Object[] values)

Methods inherited from class org.hibernate.tuple.entity.AbstractEntityTuplizer

afterInitialize, buildInstantiator, buildPropertyGetter, buildPropertySetter, buildProxyFactory, createProxy, getComponentValue, getEntityMetamodel, getEntityMode, getEntityName, getFactory, getIdentifier, getInstantiator, getPropertyValue, getPropertyValue, getPropertyValues, getPropertyValuesToInsert, getProxyFactory, getSubclassEntityNames, getVersion, hasProxy, hasUninitializedLazyProperties, instantiate, instantiate, isInstance, isLifecycleImplementor, isValidatableImplementor, resetIdentifier, setIdentifier, setPropertyValue, setPropertyValue, setPropertyValues, shouldGetAllProperties, toString

Constructor Details

PojoEntityTuplizer

public PojoEntityTuplizer(EntityMetamodel entityMetamodel,
                          PersistentClass mappedEntity)

Method Details

afterInitialize

public void afterInitialize(Object entity,
                            boolean lazyPropertiesAreUnfetched,
                            SessionImplementor session)
Called just after the entities properties have been initialized.
Specified by:
afterInitialize in interface EntityTuplizer
Overrides:
afterInitialize in interface AbstractEntityTuplizer
Parameters:
entity - The entity being initialized.
lazyPropertiesAreUnfetched - Are defined lazy properties currently unfecthed
session - The session initializing this entity.

buildInstantiator

protected Instantiator buildInstantiator(PersistentClass persistentClass)
Overrides:
buildInstantiator in interface AbstractEntityTuplizer

buildPropertyGetter

protected Getter buildPropertyGetter(Property mappedProperty,
                                     PersistentClass mappedEntity)
Overrides:
buildPropertyGetter in interface AbstractEntityTuplizer

buildPropertySetter

protected Setter buildPropertySetter(Property mappedProperty,
                                     PersistentClass mappedEntity)
Overrides:
buildPropertySetter in interface AbstractEntityTuplizer

buildProxyFactory

protected ProxyFactory buildProxyFactory(PersistentClass persistentClass,
                                         Getter idGetter,
                                         Setter idSetter)
Overrides:
buildProxyFactory in interface AbstractEntityTuplizer

buildProxyFactoryInternal

protected ProxyFactory buildProxyFactoryInternal(PersistentClass persistentClass,
                                                 Getter idGetter,
                                                 Setter idSetter)

getConcreteProxyClass

public Class getConcreteProxyClass()
Returns the java class to which generated proxies will be typed.
Specified by:
getConcreteProxyClass in interface EntityTuplizer
Returns:
The java class to which generated proxies will be typed

getEntityMode

public EntityMode getEntityMode()
Overrides:
getEntityMode in interface AbstractEntityTuplizer

getMappedClass

public Class getMappedClass()
Return the pojo class managed by this tuplizer. Need to determine how to best handle this for the Tuplizers for EntityModes other than POJO. todo : be really nice to not have this here since it is essentially pojo specific...
Specified by:
getMappedClass in interface Tuplizer
Returns:
The persistent class.

getPropertyValues

public Object[] getPropertyValues(Object entity)
            throws HibernateException
Extract the current values contained on the given entity.
Specified by:
getPropertyValues in interface Tuplizer
Overrides:
getPropertyValues in interface AbstractEntityTuplizer
Parameters:
entity - The entity from which to extract values.
Returns:
The current property values.

getPropertyValuesToInsert

public Object[] getPropertyValuesToInsert(Object entity,
                                          Map mergeMap,
                                          SessionImplementor session)
            throws HibernateException
Extract the values of the insertable properties of the entity (including backrefs)
Specified by:
getPropertyValuesToInsert in interface EntityTuplizer
Overrides:
getPropertyValuesToInsert in interface AbstractEntityTuplizer
Parameters:
entity - The entity from which to extract.
mergeMap - a map of instances being merged to merged instances
session - The session in which the resuest is being made.
Returns:
The insertable property values.

getPropertyValuesWithOptimizer

protected Object[] getPropertyValuesWithOptimizer(Object object)

hasUninitializedLazyProperties

public boolean hasUninitializedLazyProperties(Object entity)
Does the given entity instance have any currently uninitialized lazy properties?
Specified by:
hasUninitializedLazyProperties in interface EntityTuplizer
Overrides:
hasUninitializedLazyProperties in interface AbstractEntityTuplizer
Parameters:
entity - The entity to be check for uninitialized lazy properties.
Returns:
True if uninitialized lazy properties were found; false otherwise.

isInstrumented

public boolean isInstrumented()
Is it an instrumented POJO?
Specified by:
isInstrumented in interface EntityTuplizer

isLifecycleImplementor

public boolean isLifecycleImplementor()
Specified by:
isLifecycleImplementor in interface EntityTuplizer
Overrides:
isLifecycleImplementor in interface AbstractEntityTuplizer
Returns:
True if the Lifecycle interface is implemented; false otherwise.

isValidatableImplementor

public boolean isValidatableImplementor()
Specified by:
isValidatableImplementor in interface EntityTuplizer
Overrides:
isValidatableImplementor in interface AbstractEntityTuplizer
Returns:
True if the Validatable interface is implemented; false otherwise.

setPropertyValues

public void setPropertyValues(Object entity,
                              Object[] values)
            throws HibernateException
Inject the given values into the given entity.
Specified by:
setPropertyValues in interface Tuplizer
Overrides:
setPropertyValues in interface AbstractEntityTuplizer
Parameters:
entity - The entity.
values - The values to be injected.

setPropertyValuesWithOptimizer

protected void setPropertyValuesWithOptimizer(Object object,
                                              Object[] values)