org.hibernate.test.dynamicentity.tuplizer2
Class MyEntityTuplizer

java.lang.Object
  extended by org.hibernate.tuple.entity.AbstractEntityTuplizer
      extended by org.hibernate.tuple.entity.PojoEntityTuplizer
          extended by org.hibernate.test.dynamicentity.tuplizer2.MyEntityTuplizer
All Implemented Interfaces:
EntityTuplizer, Tuplizer

public class MyEntityTuplizer
extends PojoEntityTuplizer


Nested Class Summary
static class MyEntityTuplizer.MyEntityNameResolver
           
 
Field Summary
 
Fields inherited from class org.hibernate.tuple.entity.AbstractEntityTuplizer
getters, hasCustomAccessors, propertySpan, setters
 
Constructor Summary
MyEntityTuplizer(EntityMetamodel entityMetamodel, EntityBinding mappedEntity)
           
MyEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity)
           
 
Method Summary
protected  Instantiator buildInstantiator(PersistentClass persistentClass)
          Build an appropriate Instantiator for the given mapped entity.
protected  ProxyFactory buildProxyFactory(PersistentClass persistentClass, Getter idGetter, Setter idSetter)
          Build an appropriate ProxyFactory for the given mapped entity.
 String determineConcreteSubclassEntityName(Object entityInstance, SessionFactoryImplementor factory)
          Given an entity instance, determine the most appropriate (most targeted) entity-name which represents it.
 EntityNameResolver[] getEntityNameResolvers()
          Get any EntityNameResolvers associated with this Tuplizer.
 
Methods inherited from class org.hibernate.tuple.entity.PojoEntityTuplizer
afterInitialize, buildInstantiator, buildPropertyGetter, buildPropertyGetter, buildPropertySetter, buildPropertySetter, buildProxyFactory, buildProxyFactoryInternal, buildProxyFactoryInternal, getConcreteProxyClass, getEntityMode, getMappedClass, getPropertyValues, getPropertyValuesToInsert, getPropertyValuesWithOptimizer, hasUninitializedLazyProperties, isInstrumented, isLifecycleImplementor, setPropertyValues, setPropertyValuesWithOptimizer
 
Methods inherited from class org.hibernate.tuple.entity.AbstractEntityTuplizer
createProxy, getComponentValue, getEntityMetamodel, getEntityName, getFactory, getGetter, getIdentifier, getIdentifier, getIdentifierGetter, getIdentifierMapperType, getInstantiator, getPropertyValue, getPropertyValue, getProxyFactory, getSubclassEntityNames, getVersion, getVersionGetter, hasProxy, instantiate, instantiate, instantiate, isInstance, resetIdentifier, resetIdentifier, setIdentifier, setIdentifier, setPropertyValue, setPropertyValue, shouldGetAllProperties, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MyEntityTuplizer

public MyEntityTuplizer(EntityMetamodel entityMetamodel,
                        PersistentClass mappedEntity)

MyEntityTuplizer

public MyEntityTuplizer(EntityMetamodel entityMetamodel,
                        EntityBinding mappedEntity)
Method Detail

getEntityNameResolvers

public EntityNameResolver[] getEntityNameResolvers()
Description copied from class: PojoEntityTuplizer
Get any EntityNameResolvers associated with this Tuplizer.

Specified by:
getEntityNameResolvers in interface EntityTuplizer
Overrides:
getEntityNameResolvers in class PojoEntityTuplizer
Returns:
The associated resolvers. May be null or empty.

buildInstantiator

protected Instantiator buildInstantiator(PersistentClass persistentClass)
Description copied from class: PojoEntityTuplizer
Build an appropriate Instantiator for the given mapped entity.

Overrides:
buildInstantiator in class PojoEntityTuplizer
Parameters:
persistentClass - The mapping information regarding the mapped entity.
Returns:
An appropriate Instantiator instance.

determineConcreteSubclassEntityName

public String determineConcreteSubclassEntityName(Object entityInstance,
                                                  SessionFactoryImplementor factory)
Description copied from class: PojoEntityTuplizer
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).

Specified by:
determineConcreteSubclassEntityName in interface EntityTuplizer
Overrides:
determineConcreteSubclassEntityName in class PojoEntityTuplizer
Parameters:
entityInstance - The entity instance.
factory - Reference to the SessionFactory.
Returns:
The most appropriate entity name to use.

buildProxyFactory

protected ProxyFactory buildProxyFactory(PersistentClass persistentClass,
                                         Getter idGetter,
                                         Setter idSetter)
Description copied from class: PojoEntityTuplizer
Build an appropriate ProxyFactory for the given mapped entity.

Overrides:
buildProxyFactory in class PojoEntityTuplizer
Parameters:
persistentClass - The mapping information regarding the mapped entity.
idGetter - The constructed Getter relating to the entity's id property.
idSetter - The constructed Setter relating to the entity's id property.
Returns:
An appropriate ProxyFactory instance.


Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.