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

public Class DynamicMapEntityTuplizer

extends AbstractEntityTuplizer
Class Inheritance
Imports
java.util.Map, org.hibernate.EntityMode, .EntityNameResolver, .HibernateException, org.hibernate.engine.spi.SessionFactoryImplementor, org.hibernate.internal.CoreLogging, .CoreMessageLogger, org.hibernate.mapping.PersistentClass, .Property, org.hibernate.property.access.internal.PropertyAccessStrategyMapImpl, org.hibernate.property.access.spi.Getter, .PropertyAccess, .Setter, org.hibernate.proxy.ProxyFactory, org.hibernate.proxy.map.MapProxyFactory, org.hibernate.tuple.DynamicMapInstantiator, .Instantiator

An EntityTuplizer specific to the dynamic-map entity mode.
Authors
Steve Ebersole, Gavin King

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private static final CoreMessageLogger
Inherited from org.hibernate.tuple.entity.AbstractEntityTuplizer:
gettershasCustomAccessorspropertySpansetters

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected Instantiator
buildInstantiator(EntityMetamodel entityMetamodel, PersistentClass
The mapping information regarding the mapped entity.
mappingInfo
)

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

Build an appropriate Instantiator for the given mapped entity.
private PropertyAccess
buildPropertyAccess(Property mappedProperty)

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.
mappingInfo
,
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.
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 static String
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.
Inherited from org.hibernate.tuple.entity.AbstractEntityTuplizer:
afterInitializecreateProxygetComponentValuegetEntityMetamodelgetEntityNamegetFactorygetGettergetIdentifiergetIdentifiergetIdentifierGettergetIdentifierMapperTypegetInstantiatorgetPropertyValuegetPropertyValuegetPropertyValuesgetPropertyValuesToInsertgetProxyFactorygetSubclassEntityNamesgetVersiongetVersionGetterhasProxyinstantiateinstantiateinstantiateisInstanceisLifecycleImplementorlinkToSessionresetIdentifierresetIdentifiersetIdentifiersetIdentifiersetPropertyValuesetPropertyValuesetPropertyValuesshouldGetAllPropertiestoString

Field Detail

LOGback to summary
private static final CoreMessageLogger LOG

Constructor Detail

DynamicMapEntityTuplizerback to summary
pack-priv DynamicMapEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity)

Method Detail

buildInstantiatorback to summary
protected Instantiator buildInstantiator(EntityMetamodel entityMetamodel, PersistentClass mappingInfo)

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
mappingInfo:PersistentClass

The mapping information regarding the mapped entity.

Returns:Instantiator

An appropriate Instantiator instance.

Annotations
@Override
buildPropertyAccessback to summary
private PropertyAccess buildPropertyAccess(Property mappedProperty)
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 mappingInfo, 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
mappingInfo: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
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
extractEmbeddedEntityNameback to summary
public static String extractEmbeddedEntityName(Map<K, V> entity)
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
org.hibernate.tuple.entity back to summary

public Class DynamicMapEntityTuplizer.BasicEntityNameResolver

extends Object
implements EntityNameResolver
Class Inheritance
  • java.lang.Object
  • org.hibernate.tuple.entity.DynamicMapEntityTuplizer.BasicEntityNameResolver
All Implemented Interfaces
org.hibernate.EntityNameResolver

Field Summary

Modifier and TypeField and Description
public static final DynamicMapEntityTuplizer.BasicEntityNameResolver

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public String
resolveEntityName(Object
The entity instance.
entity
)

Implements org.hibernate.EntityNameResolver.resolveEntityName.

Given an entity instance, determine its entity-name.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
public static final DynamicMapEntityTuplizer.BasicEntityNameResolver INSTANCE

Constructor Detail

BasicEntityNameResolverback to summary
public BasicEntityNameResolver()

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
resolveEntityNameback to summary
public String resolveEntityName(Object entity)

Implements org.hibernate.EntityNameResolver.resolveEntityName.

Doc from org.hibernate.EntityNameResolver.resolveEntityName.

Given an entity instance, determine its entity-name.

Parameters
entity:Object

The entity instance.

Returns:String

The corresponding entity-name, or null if this impl does not know how to perform resolution for the given entity instance.

Annotations
@Override