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

public Class PojoEntityTuplizer

extends AbstractEntityTuplizer
Class Inheritance
Imports
java.lang.reflect.Method, java.util.Map, .Set, org.hibernate.EntityMode, .EntityNameResolver, .HibernateException, org.hibernate.bytecode.enhance.spi.interceptor.BytecodeLazyAttributeInterceptor, .EnhancementAsProxyLazinessInterceptor, org.hibernate.bytecode.spi.BytecodeProvider, .ProxyFactoryFactory, .ReflectionOptimizer, org.hibernate.cfg.Environment, org.hibernate.classic.Lifecycle, org.hibernate.engine.internal.ManagedTypeHelper, org.hibernate.engine.spi.SelfDirtinessTracker, .SessionFactoryImplementor, .SharedSessionContractImplementor, org.hibernate.internal.CoreLogging, .CoreMessageLogger, org.hibernate.mapping.PersistentClass, .Property, org.hibernate.property.access.spi.Getter, .Setter, org.hibernate.proxy.ProxyFactory, org.hibernate.proxy.pojo.ProxyFactoryHelper, org.hibernate.tuple.Instantiator, org.hibernate.type.CompositeType

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

Field Summary

Modifier and TypeField and Description
private final boolean
private static final CoreMessageLogger
private final Class<T>
private final ReflectionOptimizer
private final Class<T>
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
,
SharedSessionContractImplementor
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(EntityMetamodel entityMetamodel, 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)

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

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

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
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
,
SharedSessionContractImplementor
The session in which the result set 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
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:
createProxygetComponentValuegetEntityMetamodelgetEntityNamegetFactorygetGettergetIdentifiergetIdentifiergetIdentifierGettergetIdentifierMapperTypegetInstantiatorgetPropertyValuegetPropertyValuegetProxyFactorygetSubclassEntityNamesgetVersiongetVersionGetterhasProxyinstantiateinstantiateinstantiateisInstancelinkToSessionresetIdentifierresetIdentifiersetIdentifiersetIdentifiersetPropertyValuesetPropertyValueshouldGetAllPropertiestoString

Field Detail

lifecycleImplementorback to summary
private final boolean lifecycleImplementor
LOGback to summary
private static final CoreMessageLogger LOG
mappedClassback to summary
private final Class<T> mappedClass
optimizerback to summary
private final ReflectionOptimizer optimizer
proxyInterfaceback to summary
private final Class<T> proxyInterface

Constructor Detail

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

Method Detail

afterInitializeback to summary
public void afterInitialize(Object entity, SharedSessionContractImplementor 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.

session:SharedSessionContractImplementor

The session initializing this entity.

Annotations
@Override
buildInstantiatorback to summary
protected Instantiator buildInstantiator(EntityMetamodel entityMetamodel, 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.

Annotations
@Override
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.

Annotations
@Override
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.

Annotations
@Override
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.

Annotations
@Override
buildProxyFactoryInternalback to summary
protected ProxyFactory buildProxyFactoryInternal(PersistentClass persistentClass, Getter idGetter, Setter idSetter)
clearDirtyAttributesback to summary
private static void clearDirtyAttributes(final SelfDirtinessTracker entity)
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.

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

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 inheritance 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 meaning 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.

Annotations
@Override
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.spi.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

Annotations
@Override
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

Annotations
@Override
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.

Annotations
@Override
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.

Annotations
@Override
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.

Annotations
@Override
getPropertyValuesToInsertback to summary
public Object[] getPropertyValuesToInsert(Object entity, Map<K, V> mergeMap, SharedSessionContractImplementor session)

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:SharedSessionContractImplementor

The session in which the result set is being made.

Returns:Object[]

The insertable property values.

Annotations
@Override
getPropertyValuesWithOptimizerback to summary
protected Object[] getPropertyValuesWithOptimizer(Object object)
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.

Annotations
@Override
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.

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