Top Description Fields Constructors Methods
org.hibernate.tuple.entity

public Class PojoEntityTuplizer

extends AbstractEntityTuplizer
Class Inheritance
Imports
java.lang.reflect.Method, .Modifier, java.util.HashSet, .Iterator, .Map, .Set, org.slf4j.Logger, .LoggerFactory, org.hibernate.EntityMode, .EntityNameResolver, .HibernateException, .MappingException, org.hibernate.bytecode.ReflectionOptimizer, org.hibernate.cfg.Environment, org.hibernate.classic.Lifecycle, .Validatable, org.hibernate.engine.SessionFactoryImplementor, .SessionImplementor, org.hibernate.intercept.FieldInterceptionHelper, .FieldInterceptor, org.hibernate.mapping.PersistentClass, .Property, .Subclass, org.hibernate.property.Getter, .Setter, org.hibernate.proxy.HibernateProxy, .ProxyFactory, org.hibernate.tuple.Instantiator, .PojoInstantiator, org.hibernate.type.CompositeType, org.hibernate.util.ReflectHelper

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

Field Summary

Modifier and TypeField and Description
private final Set<E>
private final boolean
pack-priv static final Logger
private final Class<T>
private final ReflectionOptimizer
private final Class<T>
private final boolean
Inherited from org.hibernate.tuple.entity.AbstractEntityTuplizer:
gettershasCustomAccessorspropertySpansetters

Constructor Summary

AccessConstructor and Description
public
PojoEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity)

Method Summary

Modifier and TypeMethod and Description
public void
afterInitialize(Object
The entity being initialized.
entity
,
boolean
Are defined lazy properties currently unfecthed
lazyPropertiesAreUnfetched
,
SessionImplementor
The session initializing this entity.
session
)

Overrides org.hibernate.tuple.entity.AbstractEntityTuplizer.afterInitialize.

Implements org.hibernate.tuple.entity.EntityTuplizer.afterInitialize.

Called just after the entities properties have been initialized.
protected Instantiator
buildInstantiator(PersistentClass
The mapping information regarding the mapped entity.
persistentClass
)

Implements abstract org.hibernate.tuple.entity.AbstractEntityTuplizer.buildInstantiator.

Build an appropriate Instantiator for the given mapped entity.
protected Getter
buildPropertyGetter(Property
The property to be accessed via the built Getter.
mappedProperty
,
PersistentClass
The entity information regarding the mapped entity owning this property.
mappedEntity
)

Implements abstract org.hibernate.tuple.entity.AbstractEntityTuplizer.buildPropertyGetter.

Build an appropriate Getter for the given property.
protected Setter
buildPropertySetter(Property
The property to be accessed via the built Setter.
mappedProperty
,
PersistentClass
The entity information regarding the mapped entity owning this property.
mappedEntity
)

Implements abstract org.hibernate.tuple.entity.AbstractEntityTuplizer.buildPropertySetter.

Build an appropriate Setter for the given property.
protected ProxyFactory
buildProxyFactory(PersistentClass
The mapping information regarding the mapped entity.
persistentClass
,
Getter
The constructed Getter relating to the entity's id property.
idGetter
,
Setter
The constructed Setter relating to the entity's id property.
idSetter
)

Implements abstract org.hibernate.tuple.entity.AbstractEntityTuplizer.buildProxyFactory.

Build an appropriate ProxyFactory for the given mapped entity.
protected ProxyFactory
buildProxyFactoryInternal(PersistentClass persistentClass, Getter idGetter, Setter idSetter)

public String
determineConcreteSubclassEntityName(Object
The entity instance.
entityInstance
,
SessionFactoryImplementor
Reference to the SessionFactory.
factory
)

Implements org.hibernate.tuple.entity.EntityTuplizer.determineConcreteSubclassEntityName.

Given an entity instance, determine the most appropriate (most targeted) entity-name which represents it.
public Class<T>
getConcreteProxyClass()

Implements org.hibernate.tuple.entity.EntityTuplizer.getConcreteProxyClass.

Returns the java class to which generated proxies will be typed.
public EntityMode
getEntityMode()

Implements org.hibernate.tuple.entity.EntityTuplizer.getEntityMode.

Return the entity-mode handled by this tuplizer instance.
public EntityNameResolver[]
public Class<T>
getMappedClass()

Implements org.hibernate.tuple.Tuplizer.getMappedClass.

Return the pojo class managed by this tuplizer.
public Object[]
getPropertyValues(Object
The entity from which to extract values.
entity
)

Overrides org.hibernate.tuple.entity.AbstractEntityTuplizer.getPropertyValues.

Implements org.hibernate.tuple.Tuplizer.getPropertyValues.

Extract the current values contained on the given entity.
public Object[]
getPropertyValuesToInsert(Object
The entity from which to extract.
entity
,
Map<K, V>
a map of instances being merged to merged instances
mergeMap
,
SessionImplementor
The session in which the resuest is being made.
session
)

Overrides org.hibernate.tuple.entity.AbstractEntityTuplizer.getPropertyValuesToInsert.

Implements org.hibernate.tuple.entity.EntityTuplizer.getPropertyValuesToInsert.

Extract the values of the insertable properties of the entity (including backrefs)
protected Object[]
public boolean
hasUninitializedLazyProperties(Object
The entity to be check for uninitialized lazy properties.
entity
)

Overrides org.hibernate.tuple.entity.AbstractEntityTuplizer.hasUninitializedLazyProperties.

Implements org.hibernate.tuple.entity.EntityTuplizer.hasUninitializedLazyProperties.

Does the given entity instance have any currently uninitialized lazy properties?
public boolean
public boolean
public boolean
public void
setPropertyValues(Object
The entity.
entity
,
Object[]
The values to be injected.
values
)

Overrides org.hibernate.tuple.entity.AbstractEntityTuplizer.setPropertyValues.

Implements org.hibernate.tuple.Tuplizer.setPropertyValues.

Inject the given values into the given entity.
protected void
Inherited from org.hibernate.tuple.entity.AbstractEntityTuplizer:
createProxygetComponentValuegetEntityMetamodelgetEntityNamegetFactorygetGettergetIdentifiergetIdentifiergetIdentifierGettergetIdentifierMapperTypegetInstantiatorgetPropertyValuegetPropertyValuegetProxyFactorygetSubclassEntityNamesgetVersiongetVersionGetterhasProxyinstantiateinstantiateinstantiateisInstanceresetIdentifierresetIdentifiersetIdentifiersetIdentifiersetPropertyValuesetPropertyValueshouldGetAllPropertiestoString

Field Detail

lazyPropertyNamesback to summary
private final Set<E> lazyPropertyNames
lifecycleImplementorback to summary
private final boolean lifecycleImplementor
logback to summary
pack-priv static final Logger log

Hides org.hibernate.tuple.entity.AbstractEntityTuplizer.log.

mappedClassback to summary
private final Class<T> mappedClass
optimizerback to summary
private final ReflectionOptimizer optimizer
proxyInterfaceback to summary
private final Class<T> proxyInterface
validatableImplementorback to summary
private final boolean validatableImplementor

Constructor Detail

PojoEntityTuplizerback to summary
public PojoEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity)

Method Detail

afterInitializeback to summary
public void afterInitialize(Object entity, boolean lazyPropertiesAreUnfetched, SessionImplementor session)

Overrides org.hibernate.tuple.entity.AbstractEntityTuplizer.afterInitialize.

Implements org.hibernate.tuple.entity.EntityTuplizer.afterInitialize.

Doc from org.hibernate.tuple.entity.EntityTuplizer.afterInitialize.

Called just after the entities properties have been initialized.

Parameters
entity:Object

The entity being initialized.

lazyPropertiesAreUnfetched:boolean

Are defined lazy properties currently unfecthed

session:SessionImplementor

The session initializing this entity.

buildInstantiatorback to summary
protected Instantiator buildInstantiator(PersistentClass persistentClass)

Implements abstract org.hibernate.tuple.entity.AbstractEntityTuplizer.buildInstantiator.

Doc from org.hibernate.tuple.entity.AbstractEntityTuplizer.buildInstantiator.

Build an appropriate Instantiator for the given mapped entity.

Parameters
persistentClass:PersistentClass

The mapping information regarding the mapped entity.

Returns:Instantiator

An appropriate Instantiator instance.

buildPropertyGetterback to summary
protected Getter buildPropertyGetter(Property mappedProperty, PersistentClass mappedEntity)

Implements abstract org.hibernate.tuple.entity.AbstractEntityTuplizer.buildPropertyGetter.

Doc from org.hibernate.tuple.entity.AbstractEntityTuplizer.buildPropertyGetter.

Build an appropriate Getter for the given property.

Parameters
mappedProperty:Property

The property to be accessed via the built Getter.

mappedEntity:PersistentClass

The entity information regarding the mapped entity owning this property.

Returns:Getter

An appropriate Getter instance.

buildPropertySetterback to summary
protected Setter buildPropertySetter(Property mappedProperty, PersistentClass mappedEntity)

Implements abstract org.hibernate.tuple.entity.AbstractEntityTuplizer.buildPropertySetter.

Doc from org.hibernate.tuple.entity.AbstractEntityTuplizer.buildPropertySetter.

Build an appropriate Setter for the given property.

Parameters
mappedProperty:Property

The property to be accessed via the built Setter.

mappedEntity:PersistentClass

The entity information regarding the mapped entity owning this property.

Returns:Setter

An appropriate Setter instance.

buildProxyFactoryback to summary
protected ProxyFactory buildProxyFactory(PersistentClass persistentClass, Getter idGetter, Setter idSetter)

Implements abstract org.hibernate.tuple.entity.AbstractEntityTuplizer.buildProxyFactory.

Doc from org.hibernate.tuple.entity.AbstractEntityTuplizer.buildProxyFactory.

Build an appropriate ProxyFactory for the given mapped entity.

Parameters
persistentClass:PersistentClass

The mapping information regarding the mapped entity.

idGetter:Getter

The constructed Getter relating to the entity's id property.

idSetter:Setter

The constructed Setter relating to the entity's id property.

Returns:ProxyFactory

An appropriate ProxyFactory instance.

buildProxyFactoryInternalback to summary
protected ProxyFactory buildProxyFactoryInternal(PersistentClass persistentClass, Getter idGetter, Setter idSetter)
determineConcreteSubclassEntityNameback to summary
public String determineConcreteSubclassEntityName(Object entityInstance, SessionFactoryImplementor factory)

Implements org.hibernate.tuple.entity.EntityTuplizer.determineConcreteSubclassEntityName.

Doc from org.hibernate.tuple.entity.EntityTuplizer.determineConcreteSubclassEntityName.

Given an entity instance, determine the most appropriate (most targeted) entity-name which represents it. This is called in situations where we already know an entity name for the given entityInstance; we are being asked to determine if there is a more appropriate entity-name to use, specifically within an inheritence hierarchy.

For example, consider a case where a user calls session.update( "Animal", cat );. Here, the user has explicitly provided Animal as the entity-name. However, they have passed in an instance of Cat which is a subclass of Animal. In this case, we would return Cat as the entity-name.

null may be returned from calls to this method. The meaining of null in that case is assumed to be that we should use whatever explicit entity-name the user provided (Animal rather than Cat in the example above).

Parameters
entityInstance:Object

The entity instance.

factory:SessionFactoryImplementor

Reference to the SessionFactory.

Returns:String

The most appropriate entity name to use.

getConcreteProxyClassback to summary
public Class<T> getConcreteProxyClass()

Implements org.hibernate.tuple.entity.EntityTuplizer.getConcreteProxyClass.

Doc from org.hibernate.tuple.entity.EntityTuplizer.getConcreteProxyClass.

Returns the java class to which generated proxies will be typed.

todo : look at fully encapsulating org.hibernate.engine.PersistenceContext#narrowProxy here, since that is the only external use of this method

Returns:Class<T>

The java class to which generated proxies will be typed

getEntityModeback to summary
public EntityMode getEntityMode()

Implements org.hibernate.tuple.entity.EntityTuplizer.getEntityMode.

Doc from org.hibernate.tuple.entity.EntityTuplizer.getEntityMode.

Return the entity-mode handled by this tuplizer instance.

Returns:EntityMode

The entity-mode

getEntityNameResolversback to summary
public EntityNameResolver[] getEntityNameResolvers()

Implements org.hibernate.tuple.entity.EntityTuplizer.getEntityNameResolvers.

Doc from org.hibernate.tuple.entity.EntityTuplizer.getEntityNameResolvers.

Get any EntityNameResolvers associated with this Tuplizer.

Returns:EntityNameResolver[]

The associated resolvers. May be null or empty.

getMappedClassback to summary
public Class<T> getMappedClass()

Implements org.hibernate.tuple.Tuplizer.getMappedClass.

Doc from org.hibernate.tuple.Tuplizer.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...
Returns:Class<T>

The persistent class.

getPropertyValuesback to summary
public Object[] getPropertyValues(Object entity) throws HibernateException

Overrides org.hibernate.tuple.entity.AbstractEntityTuplizer.getPropertyValues.

Implements org.hibernate.tuple.Tuplizer.getPropertyValues.

Doc from org.hibernate.tuple.Tuplizer.getPropertyValues.

Extract the current values contained on the given entity.

Parameters
entity:Object

The entity from which to extract values.

Returns:Object[]

The current property values.

getPropertyValuesToInsertback to summary
public Object[] getPropertyValuesToInsert(Object entity, Map<K, V> mergeMap, SessionImplementor session) throws HibernateException

Overrides org.hibernate.tuple.entity.AbstractEntityTuplizer.getPropertyValuesToInsert.

Implements org.hibernate.tuple.entity.EntityTuplizer.getPropertyValuesToInsert.

Doc from org.hibernate.tuple.entity.EntityTuplizer.getPropertyValuesToInsert.

Extract the values of the insertable properties of the entity (including backrefs)

Parameters
entity:Object

The entity from which to extract.

mergeMap:Map<K, V>

a map of instances being merged to merged instances

session:SessionImplementor

The session in which the resuest is being made.

Returns:Object[]

The insertable property values.

getPropertyValuesWithOptimizerback to summary
protected Object[] getPropertyValuesWithOptimizer(Object object)
hasUninitializedLazyPropertiesback to summary
public boolean hasUninitializedLazyProperties(Object entity)

Overrides org.hibernate.tuple.entity.AbstractEntityTuplizer.hasUninitializedLazyProperties.

Implements org.hibernate.tuple.entity.EntityTuplizer.hasUninitializedLazyProperties.

Doc from org.hibernate.tuple.entity.EntityTuplizer.hasUninitializedLazyProperties.

Does the given entity instance have any currently uninitialized lazy properties?

Parameters
entity:Object

The entity to be check for uninitialized lazy properties.

Returns:boolean

True if uninitialized lazy properties were found; false otherwise.

isInstrumentedback to summary
public boolean isInstrumented()

Implements org.hibernate.tuple.entity.EntityTuplizer.isInstrumented.

Doc from org.hibernate.tuple.entity.EntityTuplizer.isInstrumented.

Is it an instrumented POJO?

isLifecycleImplementorback to summary
public boolean isLifecycleImplementor()

Overrides org.hibernate.tuple.entity.AbstractEntityTuplizer.isLifecycleImplementor.

Implements org.hibernate.tuple.entity.EntityTuplizer.isLifecycleImplementor.

Doc from org.hibernate.tuple.entity.EntityTuplizer.isLifecycleImplementor.

Does the class managed by this tuplizer implement the org.hibernate.classic.Lifecycle interface.

Returns:boolean

True if the Lifecycle interface is implemented; false otherwise.

isValidatableImplementorback to summary
public boolean isValidatableImplementor()

Overrides org.hibernate.tuple.entity.AbstractEntityTuplizer.isValidatableImplementor.

Implements org.hibernate.tuple.entity.EntityTuplizer.isValidatableImplementor.

Doc from org.hibernate.tuple.entity.EntityTuplizer.isValidatableImplementor.

Does the class managed by this tuplizer implement the org.hibernate.classic.Validatable interface.

Returns:boolean

True if the Validatable interface is implemented; false otherwise.

setPropertyValuesback to summary
public void setPropertyValues(Object entity, Object[] values) throws HibernateException

Overrides org.hibernate.tuple.entity.AbstractEntityTuplizer.setPropertyValues.

Implements org.hibernate.tuple.Tuplizer.setPropertyValues.

Doc from org.hibernate.tuple.Tuplizer.setPropertyValues.

Inject the given values into the given entity.

Parameters
entity:Object

The entity.

values:Object[]

The values to be injected.

setPropertyValuesWithOptimizerback to summary
protected void setPropertyValuesWithOptimizer(Object object, Object[] values)