java.lang.Object
   ↳ org.hibernate.persister.entity.AbstractEntityPersister
Known Direct Subclasses

Class Overview

Basic functionality for persisting an entity via JDBC through either generated or custom SQL

Summary

Nested Classes
interface AbstractEntityPersister.InclusionChecker  
Constants
String ENTITY_CLASS
[Expand]
Inherited Constants
From interface org.hibernate.persister.entity.EntityPersister
From interface org.hibernate.persister.entity.Loadable
Fields
protected String[] customSQLDelete
protected String[] customSQLInsert
protected String[] customSQLUpdate
protected boolean[] deleteCallable
protected ExecuteUpdateResultCheckStyle[] deleteResultCheckStyles
protected boolean[] insertCallable
protected ExecuteUpdateResultCheckStyle[] insertResultCheckStyles
protected final BasicEntityPropertyMapping propertyMapping
protected final String rowIdName
protected boolean[] updateCallable
protected ExecuteUpdateResultCheckStyle[] updateResultCheckStyles
[Expand]
Inherited Fields
From interface org.hibernate.intercept.LazyPropertyInitializer
Public Constructors
AbstractEntityPersister(PersistentClass persistentClass, EntityRegionAccessStrategy cacheAccessStrategy, SessionFactoryImplementor factory)
Public Methods
void afterInitialize(Object entity, boolean lazyPropertiesAreUnfetched, SessionImplementor session)
Called just after the entities properties have been initialized
void afterReassociate(Object entity, SessionImplementor session)
Called just after the entity has been reassociated with the session
boolean canExtractIdOutOfEntity()
Determine whether detached instances of this entity carry their own identifier value.
boolean consumesCollectionAlias()
Very, very, very ugly...
boolean consumesEntityAlias()
Very, very, very ugly...
int countSubclassProperties()
How many properties are there, for this class and all subclasses?
Object createProxy(Serializable id, SessionImplementor session)
Create a new proxy instance
void delete(Serializable id, Object version, Object object, SessionImplementor session)
Delete an object
String filterFragment(String alias, Map enabledFilters)
Get the where clause filter, given a query alias and considering enabled session filters
int[] findDirty(Object[] currentState, Object[] previousState, Object entity, SessionImplementor session)
Locate the property-indices of all properties considered to be dirty.
int[] findModified(Object[] old, Object[] current, Object entity, SessionImplementor session)
Locate the property-indices of all properties considered to be dirty.
Object forceVersionIncrement(Serializable id, Object currentVersion, SessionImplementor session)
String fromJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses)
Get the from clause part of any joins (optional operation)
String generateFilterConditionAlias(String rootAlias)
The alias used for any filter conditions (mapped where-fragments or enabled-filters).
EntityRegionAccessStrategy getCacheAccessStrategy()
Get the cache (optional operation)
CacheEntryStructure getCacheEntryStructure()
Get the cache structure
CascadeStyle getCascadeStyle(int i)
Get the cascade style of this (subclass closure) property
ClassMetadata getClassMetadata()
Get the user-visible metadata for the class (optional operation)
Class getConcreteProxyClass(EntityMode entityMode)
Get the proxy interface that instances of this concrete class will be cast to (optional operation).
Object getCurrentVersion(Serializable id, SessionImplementor session)
Retrieve the version number
Object[] getDatabaseSnapshot(Serializable id, SessionImplementor session)
Get the current database state of the object, in a "hydrated" form, without resolving identifiers
String getDiscriminatorAlias(String suffix)
Get the result set aliases used for the identifier columns, given a suffix
String getDiscriminatorColumnName()
String getDiscriminatorColumnReaderTemplate()
String getDiscriminatorColumnReaders()
EntityMetamodel getEntityMetamodel()
Retrieve the underlying entity metamodel instance...
final String getEntityName()
The entity name which this persister maps.
EntityType getEntityType()
SessionFactoryImplementor getFactory()
Return the SessionFactory to which this persister "belongs".
FetchMode getFetchMode(int i)
May this (subclass closure) property be fetched using an SQL outerjoin?
Serializable getIdentifier(Object object, EntityMode entityMode)
Get the identifier of an instance (throw an exception if no identifier property)
Serializable getIdentifier(Object entity, SessionImplementor session)
Get the identifier of an instance (throw an exception if no identifier property)
String[] getIdentifierAliases(String suffix)
Get the result set aliases used for the identifier columns, given a suffix
String[] getIdentifierColumnNames()
Get the names of columns used to persist the identifier
String[] getIdentifierColumnReaderTemplates()
String[] getIdentifierColumnReaders()
IdentifierGenerator getIdentifierGenerator()
Determine which identifier generation strategy is used for this entity.
String getIdentifierPropertyName()
Get the name of the identifier property (or return null) - need not return the name of an actual Java property
Type getIdentifierType()
Get the identifier type
String getIdentitySelectString()
Get the database-specific SQL command to retrieve the last generated IDENTITY value.
String[] getKeyColumnNames()
The columns to join on
final Class getMappedClass(EntityMode entityMode)
The persistent class, or null
String getMappedSuperclass()
Get the class that this class is mapped as a subclass of - not necessarily the direct superclass
String getName()
An identifying name; a class name or collection role name.
int[] getNaturalIdentifierProperties()
If the entity defines a natural id (hasNaturalIdentifier()), which properties make up the natural id.
Object[] getNaturalIdentifierSnapshot(Serializable id, SessionImplementor session)
Retrieve the current state of the natural-id properties from the database.
boolean[] getNonLazyPropertyUpdateability()
String[] getPropertyAliases(String suffix, int i)
Get the result set aliases used for the property columns, given a suffix (properties of this class, only).
CascadeStyle[] getPropertyCascadeStyles()
Get the cascade styles of the properties (optional operation)
boolean[] getPropertyCheckability()
Get the "checkability" of the properties of this class (is the property dirty checked, does the cache need to be updated)
String[] getPropertyColumnNames(String propertyName)
Get the column names for the given property path
String[] getPropertyColumnNames(int i)
Get the result set column names mapped for this property (properties of this class, only).
String[] getPropertyColumnWriters(int i)
int getPropertyIndex(String propertyName)
Get the property number of the unique key property
ValueInclusion[] getPropertyInsertGenerationInclusions()
Which of the properties of this class are database generated values on insert?
boolean[] getPropertyInsertability()
Get the "insertability" of the properties of this class (does the property appear in an SQL INSERT)
boolean[] getPropertyLaziness()
Get the "laziness" of the properties of this class
String[] getPropertyNames()
Get the names of the class properties - doesn't have to be the names of the actual Java properties (used for XML generation only)
boolean[] getPropertyNullability()
Get the nullability of the properties of this class
Type getPropertyType(String propertyName)
Get the type of a particular property by name.
Type[] getPropertyTypes()
Get the Hibernate types of the class properties
boolean[] getPropertyUniqueness()
ValueInclusion[] getPropertyUpdateGenerationInclusions()
Which of the properties of this class are database generated values on update?
boolean[] getPropertyUpdateability()
Get the "updateability" of the properties of this class (does the property appear in an SQL UPDATE)
Object getPropertyValue(Object object, int i, EntityMode entityMode)
Get the value of a particular property
Object getPropertyValue(Object object, String propertyName, EntityMode entityMode)
Get the value of a particular property
Object[] getPropertyValues(Object object, EntityMode entityMode)
Return the (loaded) values of the mapped properties of the object (not including backrefs)
Object[] getPropertyValuesToInsert(Object object, Map mergeMap, SessionImplementor session)
Return the values of the insertable properties of the object (including backrefs)
boolean[] getPropertyVersionability()
Get the "versionability" of the properties of this class (is the property optimistic-locked)
Serializable[] getQuerySpaces()
Returns an array of objects that identify spaces in which properties of this entity are persisted, for instances of this class and its subclasses.
String getRootEntityName()
Returns an object that identifies the space in which identifiers of this entity hierarchy are unique.
String getRootTableAlias(String drivingAlias)
Get the SQL alias this persister would use for the root table given the passed driving alias.
String[] getRootTableIdentifierColumnNames()
Get the names of columns on the root table used to persist the identifier.
String[] getRootTableKeyColumnNames()
The names of the primary key columns in the root table.
String getRootTableName()
Locks are always applied to the "root table".
String getSelectByUniqueKeyString(String propertyName)
Get a SQL select string that performs a select based on a unique key determined by the given property name).
String[] getSubclassColumnReaderTemplateClosure()
EntityPersister getSubclassEntityPersister(Object instance, SessionFactoryImplementor factory, EntityMode entityMode)
A request has already identified the entity-name of this persister as the mapping for the given instance.
String[] getSubclassPropertyColumnAliases(String propertyName, String suffix)
Return the column alias names used to persist/query the named property of the class or a subclass (optional operation).
String[] getSubclassPropertyColumnNames(int i)
Return the column names used to persist the numbered property of the class or a subclass.
String[] getSubclassPropertyColumnNames(String propertyName)
Return the column names used to persist/query the named property of the class or a subclass (optional operation).
String[][] getSubclassPropertyColumnReaderClosure()
String[][] getSubclassPropertyColumnReaderTemplateClosure()
Queryable.Declarer getSubclassPropertyDeclarer(String propertyPath)
Determine whether the given property is declared by our mapped class, our super class, or one of our subclasses...
String getSubclassPropertyName(int i)
Get the name of the numbered property of the class or a subclass.
int getSubclassPropertyTableNumber(String propertyPath)
Warning: When there are duplicated property names in the subclasses of the class, this method may return the wrong table number for the duplicated subclass property (note that SingleTableEntityPersister defines an overloaded form which takes the entity name.
Type getSubclassPropertyType(int i)
Get the type of the numbered property of the class or a subclass.
abstract String getSubclassTableName(int j)
Get the name of the table with the given index from the internal array.
String getTemporaryIdTableDDL()
Get the appropriate DDL command for generating the temporary table to be used to (potentially) store id values when performing bulk update/deletes.
String getTemporaryIdTableName()
Get the name of the temporary table to be used to (potentially) store id values when performing bulk update/deletes.
Type getType()
Get the type of the thing containing the properties
DiscriminatorMetadata getTypeDiscriminatorMetadata()
Retrieve the information needed to properly deal with this entity's discriminator in a query.
Object getVersion(Object object, EntityMode entityMode)
Get the version number (or timestamp) from the object's version property (or return null if not versioned)
String getVersionColumnName()
For versioned entities, get the name of the column (again, expected on the root table) used to store the version values.
Comparator getVersionComparator()
Get the comparator used to compare two different version values.
int getVersionProperty()
If isVersioned(), then what is the index of the property holding the locking value.
VersionType getVersionType()
If isVersioned(), then what is the type of the property holding the locking value.
EntityMode guessEntityMode(Object object)
Try to discover the entity mode from the entity instance
boolean hasCache()
Does this class have a cache.
boolean hasCascades()
Determine whether this entity has any non-none cascading.
boolean hasCollections()
Determine whether this entity contains references to persistent collections.
boolean hasIdentifierProperty()
Determine whether the entity has a particular property holding the identifier value.
boolean hasInsertGeneratedProperties()
Does this entity define any properties as being database generated on insert?
boolean hasLazyProperties()
Determine whether this entity defines any lazy properties (ala bytecode instrumentation).
boolean hasMutableProperties()
Determine whether any properties of this entity are considered mutable.
boolean hasNaturalIdentifier()
Determine whether this entity defines a natural identifier.
boolean hasProxy()
Determine whether this entity supports dynamic proxies.
boolean hasRowId()
Does the result set contain rowids?
boolean hasSequentialSelect()
boolean hasSubclasses()
Does this entity have mapped subclasses?
boolean hasSubselectLoadableCollections()
Determine whether this entity contains references to persistent collections which are fetchable by subselect?
boolean hasUninitializedLazyProperties(Object object, EntityMode entityMode)
Does the given instance have any uninitialized lazy properties?
boolean hasUpdateGeneratedProperties()
Does this entity define any properties as being database generated on update?
Object[] hydrate(ResultSet rs, Serializable id, Object object, Loadable rootLoadable, String[][] suffixedPropertyColumns, boolean allProperties, SessionImplementor session)
Unmarshall the fields of a persistent instance from a result set, without resolving associations or collections.
String identifierSelectFragment(String name, String suffix)
Given a query alias and an identifying suffix, render the intentifier select fragment.
boolean implementsLifecycle(EntityMode entityMode)
Does the class implement the Lifecycle interface.
boolean implementsValidatable(EntityMode entityMode)
Does the class implement the Validatable interface.
Object initializeLazyProperty(String fieldName, Object entity, SessionImplementor session)
Initialize the property, and return its new value
void insert(Serializable id, Object[] fields, Object object, SessionImplementor session)
Persist an instance
Serializable insert(Object[] fields, Object object, SessionImplementor session)
Persist an instance, using a natively generated identifier (optional operation)
Object instantiate(Serializable id, EntityMode entityMode)
Create a class instance initialized with the given identifier
Object instantiate(Serializable id, SessionImplementor session)
Create a class instance initialized with the given identifier
boolean isAbstract()
Is this an abstract class?
boolean isBatchLoadable()
Is batch loading enabled?
boolean isBatchable()
boolean isCacheInvalidationRequired()
We can't immediately add to the cache if we have formulas which must be evaluated, or if we have the possibility of two concurrent updates to the same item being merged on the database.
boolean isCollection()
Is this instance actually a CollectionPersister?
boolean isDefinedOnSubclass(int i)
Is this property defined on a subclass of the mapped class.
boolean isExplicitPolymorphism()
Is this class explicit polymorphism only?
boolean isIdentifierAssignedByInsert()
Are identifiers of this entity assigned known before the insert execution? Or, are they generated (in the database) by the insert execution.
boolean isInherited()
Determine whether the entity is inherited one or more other entities.
boolean isInstance(Object object, EntityMode entityMode)
Is the given object an instance of this entity?
boolean isInstrumented(EntityMode entityMode)
Has the class actually been bytecode instrumented?
boolean isLazyPropertiesCacheable()
Should lazy properties of this entity be cached?
boolean isMultiTable()
Is the inheritence hierarchy described by this persister contained across multiple tables?
boolean isMutable()
Determine whether instances of this entity are considered mutable.
boolean isPolymorphic()
boolean isSelectBeforeUpdateRequired()
Is select snapshot before update enabled?
boolean isSubclassEntityName(String entityName)
Determine whether the given name represents a subclass entity (or this entity itself) of the entity mapped by this persister.
boolean isSubclassPropertyNullable(int i)
Is the numbered property of the class of subclass nullable?
Boolean isTransient(Object entity, SessionImplementor session)
Is this a new transient instance?
boolean isVersionPropertyGenerated()
Does this entity contain a version property that is defined to be database generated?
boolean isVersionPropertyInsertable()
Is the version property included in insert statements?
boolean isVersioned()
Determine whether optimistic locking by column is enabled for this entity.
Object load(Serializable id, Object optionalObject, LockOptions lockOptions, SessionImplementor session)
Load an instance using either the forUpdateLoader or the outer joining loader, depending upon the value of the lock parameter
Object load(Serializable id, Object optionalObject, LockMode lockMode, SessionImplementor session)
Load an instance using either the forUpdateLoader or the outer joining loader, depending upon the value of the lock parameter
Object loadByUniqueKey(String propertyName, Object uniqueKey, SessionImplementor session)
Load an instance of the persistent class, by a unique key other than the primary key.
void lock(Serializable id, Object version, Object object, LockOptions lockOptions, SessionImplementor session)
Do a version check (optional operation)
void lock(Serializable id, Object version, Object object, LockMode lockMode, SessionImplementor session)
Do a version check (optional operation)
String oneToManyFilterFragment(String alias)
void postInstantiate()
Finish the initialization of this object.
void processInsertGeneratedProperties(Serializable id, Object entity, Object[] state, SessionImplementor session)
Perform a select to retrieve the values of any generated properties back from the database, injecting these generated values into the given entity as well as writing this state to the PersistenceContext.
void processUpdateGeneratedProperties(Serializable id, Object entity, Object[] state, SessionImplementor session)
Perform a select to retrieve the values of any generated properties back from the database, injecting these generated values into the given entity as well as writing this state to the PersistenceContext.
String propertySelectFragment(String tableAlias, String suffix, boolean allProperties)
Given a query alias and an identifying suffix, render the property select fragment.
SelectFragment propertySelectFragmentFragment(String tableAlias, String suffix, boolean allProperties)
void registerAffectingFetchProfile(String fetchProfileName)
Register the name of a fetch profile determined to have an affect on the underlying loadable in regards to the fact that the underlying load SQL needs to be adjust when the given fetch profile is enabled.
void resetIdentifier(Object entity, Serializable currentId, Object currentVersion, SessionImplementor session)
Set the identifier and version of the given instance back to its "unsaved" value.
void resetIdentifier(Object entity, Serializable currentId, Object currentVersion, EntityMode entityMode)
Set the identifier and version of the given instance back to its "unsaved" value.
String selectFragment(String alias, String suffix)
Generate a list of collection index, key and element columns
final String selectFragment(Joinable rhs, String rhsAlias, String lhsAlias, String entitySuffix, String collectionSuffix, boolean includeCollectionColumns)
All columns to select, when loading.
void setIdentifier(Object entity, Serializable id, SessionImplementor session)
Inject the identifier value into the given entity.
void setIdentifier(Object entity, Serializable id, EntityMode entityMode)
Inject the identifier value into the given entity.
void setPropertyValue(Object object, String propertyName, Object value, EntityMode entityMode)
Set the value of a particular (named) property
void setPropertyValue(Object object, int i, Object value, EntityMode entityMode)
Set the value of a particular property
void setPropertyValues(Object object, Object[] values, EntityMode entityMode)
Set the given values to the mapped properties of the given object
String[] toColumns(String name, int i)
Given the number of a property of a subclass, and a table alias, return the aliased column names.
String[] toColumns(String alias, String propertyName)
Given a query alias and a property path, return the qualified column name
String[] toColumns(String propertyName)
Given a property path, return the corresponding column name(s).
String toString()
Type toType(String propertyName)
Given a component path expression, get the type of the property
void update(Serializable id, Object[] fields, int[] dirtyFields, boolean hasDirtyCollection, Object[] oldFields, Object oldVersion, Object object, Object rowId, SessionImplementor session)
Update an object
String whereJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses)
Get the where clause part of any joins (optional operation)
Protected Methods
void addDiscriminatorToInsert(Insert insert)
void addDiscriminatorToSelect(SelectFragment select, String name, String suffix)
boolean check(int rows, Serializable id, int tableNumber, Expectation expectation, PreparedStatement statement)
String concretePropertySelectFragment(String alias, AbstractEntityPersister.InclusionChecker inclusionChecker)
String concretePropertySelectFragment(String alias, boolean[] includeProperty)
String concretePropertySelectFragment(String alias, ValueInclusion[] inclusions)
String concretePropertySelectFragmentSansLeadingComma(String alias, boolean[] include)
UniqueEntityLoader createEntityLoader(LockMode lockMode, LoadQueryInfluencers loadQueryInfluencers)
UniqueEntityLoader createEntityLoader(LockMode lockMode)
UniqueEntityLoader createEntityLoader(LockOptions lockOptions, LoadQueryInfluencers loadQueryInfluencers)
String createFrom(int tableNumber, String alias)
JoinFragment createJoin(String name, boolean innerJoin, boolean includeSubclasses)
JoinFragment createJoin(int[] tableNumbers, String drivingAlias)
void createLoaders()
void createQueryLoader()
SelectFragment createSelect(int[] subclassColumnNumbers, int[] subclassFormulaNumbers)
void createUniqueKeyLoaders()
String createWhereByKey(int tableNumber, String alias)
int dehydrate(Serializable id, Object[] fields, boolean[] includeProperty, boolean[][] includeColumns, int j, PreparedStatement st, SessionImplementor session)
int dehydrate(Serializable id, Object[] fields, Object rowId, boolean[] includeProperty, boolean[][] includeColumns, int j, PreparedStatement ps, SessionImplementor session, int index)
Marshall the fields of a persistent instance to a prepared statement
void delete(Serializable id, Object version, int j, Object object, String sql, SessionImplementor session, Object[] loadedState)
Perform an SQL DELETE
abstract String filterFragment(String alias)
String generateDeleteString(int j)
Generate the SQL that deletes a row by id (and version)
String generateIdentityInsertString(boolean[] includeProperty)
Used to generate an insery statement against the root table in the case of identifier generation strategies where the insert statement executions actually generates the identifier value.
String generateInsertGeneratedValuesSelectString()
String generateInsertString(boolean[] includeProperty, int j)
String generateInsertString(boolean identityInsert, boolean[] includeProperty)
String generateInsertString(boolean identityInsert, boolean[] includeProperty, int j)
Generate the SQL that inserts a row
String generateLazySelectString()
LockingStrategy generateLocker(LockMode lockMode)
String generateSelectVersionString()
Generate the SQL that selects the version number by id
String generateSnapshotSelectString()
String generateTableAlias(String rootAlias, int tableNumber)
String generateUpdateGeneratedValuesSelectString()
String generateUpdateString(boolean[] includeProperty, int j, boolean useRowId)
String generateUpdateString(boolean[] includeProperty, int j, Object[] oldFields, boolean useRowId)
Generate the SQL that updates a row by id (and version)
String getDiscriminatorAlias()
String getDiscriminatorFormulaTemplate()
String[] getIdentifierAliases()
int getIdentifierColumnSpan()
abstract String[] getKeyColumns(int j)
Set getLazyProperties()
Map getLoaders()
boolean[] getPropertiesToInsert(Object[] fields)
Transform the array of property indexes to an array of booleans, true when the property is insertable and non-null
final boolean[] getPropertiesToUpdate(int[] dirtyProperties, boolean hasDirtyCollection)
Transform the array of property indexes to an array of booleans, true when the property is dirty
boolean[][] getPropertyColumnInsertable()
int getPropertyColumnSpan(int i)
boolean[][] getPropertyColumnUpdateable()
boolean[] getPropertySelectable()
int getPropertySpan()
String[] getPropertySubclassNames()
abstract int[] getPropertyTableNumbers()
abstract int[] getPropertyTableNumbersInSelect()
boolean[] getPropertyUpdateability(Object entity, EntityMode entityMode)
Which properties appear in the SQL update? (Initialized, updateable ones!)
String[] getSQLDeleteStrings()
String getSQLIdentityInsertString()
The query that inserts a row, letting the database generate an id
String[] getSQLInsertStrings()
String getSQLLazySelectString()
String[] getSQLLazyUpdateByRowIdStrings()
String[] getSQLLazyUpdateStrings()
String getSQLSnapshotSelectString()
String[] getSQLUpdateByRowIdStrings()
String[] getSQLUpdateStrings()
String getSQLWhereString(String alias)
String getSequentialSelect(String entityName)
String[] getSubclassColumnAliasClosure()
String[] getSubclassColumnClosure()
boolean[] getSubclassColumnLazyiness()
abstract int[] getSubclassColumnTableNumberClosure()
String[] getSubclassFormulaAliasClosure()
String[] getSubclassFormulaClosure()
boolean[] getSubclassFormulaLazyiness()
abstract int[] getSubclassFormulaTableNumberClosure()
String[] getSubclassFormulaTemplateClosure()
String[][] getSubclassPropertyColumnNameClosure()
String[][] getSubclassPropertyFormulaTemplateClosure()
String[] getSubclassPropertyNameClosure()
String[] getSubclassPropertySubclassNameClosure()
abstract int getSubclassPropertyTableNumber(int i)
Type[] getSubclassPropertyTypeClosure()
abstract String[] getSubclassTableKeyColumns(int j)
abstract int getSubclassTableSpan()
abstract String getTableName(int j)
abstract int getTableSpan()
boolean[] getTableUpdateNeeded(int[] dirtyProperties, boolean hasDirtyCollection)
Decide which tables need to be updated.
EntityTuplizer getTuplizer(EntityMode entityMode)
EntityTuplizer getTuplizer(SessionImplementor session)
String getVersionSelectString()
String getVersionedTableName()
boolean hasEmbeddedCompositeIdentifier()
boolean hasFormulaProperties()
boolean hasWhere()
void initLockers()
void initPropertyPaths(Mapping mapping)
void initSubclassPropertyAliasesMap(PersistentClass model)
Must be called by subclasses, at the end of their constructors
void insert(Serializable id, Object[] fields, boolean[] notNull, int j, String sql, Object object, SessionImplementor session)
Perform an SQL INSERT.
Serializable insert(Object[] fields, boolean[] notNull, String sql, Object object, SessionImplementor session)
Perform an SQL INSERT, and then retrieve a generated identifier.
abstract boolean isClassOrSuperclassTable(int j)
boolean isDeleteCallable(int j)
boolean isInsertCallable(int j)
boolean isInverseSubclassTable(int j)
boolean isInverseTable(int j)
boolean isNullableSubclassTable(int j)
boolean isNullableTable(int j)
abstract boolean isPropertyOfTable(int property, int j)
boolean isSubclassPropertyDeferred(String propertyName, String entityName)
boolean isSubclassTableLazy(int j)
boolean isSubclassTableSequentialSelect(int j)
abstract boolean isTableCascadeDeleteEnabled(int j)
boolean isUpdateCallable(int j)
void logStaticSQL()
final int optimisticLockMode()
void postConstruct(Mapping mapping)
String renderSelect(int[] tableNumbers, int[] columnNumbers, int[] formulaNumbers)
boolean update(Serializable id, Object[] fields, Object[] oldFields, Object rowId, boolean[] includeProperty, int j, Object oldVersion, Object object, String sql, SessionImplementor session)
void updateOrInsert(Serializable id, Object[] fields, Object[] oldFields, Object rowId, boolean[] includeProperty, int j, Object oldVersion, Object object, String sql, SessionImplementor session)
Perform an SQL UPDATE or SQL INSERT
boolean useDynamicInsert()
boolean useDynamicUpdate()
boolean useGetGeneratedKeys()
boolean useInsertSelectIdentity()
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.hibernate.cache.OptimisticCacheSource
From interface org.hibernate.id.PostInsertIdentityPersister
From interface org.hibernate.intercept.LazyPropertyInitializer
From interface org.hibernate.metadata.ClassMetadata
From interface org.hibernate.persister.entity.EntityPersister
From interface org.hibernate.persister.entity.Joinable
From interface org.hibernate.persister.entity.Loadable
From interface org.hibernate.persister.entity.Lockable
From interface org.hibernate.persister.entity.OuterJoinLoadable
From interface org.hibernate.persister.entity.PropertyMapping
From interface org.hibernate.persister.entity.Queryable
From interface org.hibernate.persister.entity.SQLLoadable
From interface org.hibernate.persister.entity.UniqueKeyLoadable

Constants

public static final String ENTITY_CLASS

Constant Value: "class"

Fields

protected String[] customSQLDelete

protected String[] customSQLInsert

protected String[] customSQLUpdate

protected boolean[] deleteCallable

protected ExecuteUpdateResultCheckStyle[] deleteResultCheckStyles

protected boolean[] insertCallable

protected ExecuteUpdateResultCheckStyle[] insertResultCheckStyles

protected final BasicEntityPropertyMapping propertyMapping

protected final String rowIdName

protected boolean[] updateCallable

protected ExecuteUpdateResultCheckStyle[] updateResultCheckStyles

Public Constructors

public AbstractEntityPersister (PersistentClass persistentClass, EntityRegionAccessStrategy cacheAccessStrategy, SessionFactoryImplementor factory)

Public Methods

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

Called just after the entities properties have been initialized

public void afterReassociate (Object entity, SessionImplementor session)

Called just after the entity has been reassociated with the session

public boolean canExtractIdOutOfEntity ()

Determine whether detached instances of this entity carry their own identifier value.

The other option is the deprecated feature where users could supply the id during session calls.

Returns
  • True if either (1) hasIdentifierProperty() or (2) the identifier is an embedded composite identifier; false otherwise.

public boolean consumesCollectionAlias ()

Very, very, very ugly...

Returns
  • Does this persister "consume" collection column aliases in the result set?

public boolean consumesEntityAlias ()

Very, very, very ugly...

Returns
  • Does this persister "consume" entity column aliases in the result set?

public int countSubclassProperties ()

How many properties are there, for this class and all subclasses?

public Object createProxy (Serializable id, SessionImplementor session)

Create a new proxy instance

public void delete (Serializable id, Object version, Object object, SessionImplementor session)

Delete an object

public String filterFragment (String alias, Map enabledFilters)

Get the where clause filter, given a query alias and considering enabled session filters

public int[] findDirty (Object[] currentState, Object[] previousState, Object entity, SessionImplementor session)

Locate the property-indices of all properties considered to be dirty.

Parameters
currentState The current state of the entity (the state to be checked).
previousState The previous state of the entity (the state to be checked against).
entity The entity for which we are checking state dirtiness.
session The session in which the check is ccurring.
Returns
  • null or the indices of the dirty properties

public int[] findModified (Object[] old, Object[] current, Object entity, SessionImplementor session)

Locate the property-indices of all properties considered to be dirty.

Parameters
old The old state of the entity.
current The current state of the entity.
entity The entity for which we are checking state modification.
session The session in which the check is ccurring.
Returns
  • null or the indices of the modified properties

public Object forceVersionIncrement (Serializable id, Object currentVersion, SessionImplementor session)

public String fromJoinFragment (String alias, boolean innerJoin, boolean includeSubclasses)

Get the from clause part of any joins (optional operation)

public String generateFilterConditionAlias (String rootAlias)

The alias used for any filter conditions (mapped where-fragments or enabled-filters).

This may or may not be different from the root alias depending upon the inheritence mapping strategy.

Parameters
rootAlias The root alias
Returns
  • The alias used for "filter conditions" within the where clause.

public EntityRegionAccessStrategy getCacheAccessStrategy ()

Get the cache (optional operation)

public CacheEntryStructure getCacheEntryStructure ()

Get the cache structure

public CascadeStyle getCascadeStyle (int i)

Get the cascade style of this (subclass closure) property

public ClassMetadata getClassMetadata ()

Get the user-visible metadata for the class (optional operation)

public Class getConcreteProxyClass (EntityMode entityMode)

Get the proxy interface that instances of this concrete class will be cast to (optional operation).

public Object getCurrentVersion (Serializable id, SessionImplementor session)

Retrieve the version number

public Object[] getDatabaseSnapshot (Serializable id, SessionImplementor session)

Get the current database state of the object, in a "hydrated" form, without resolving identifiers

Returns
  • null if there is no row in the database

public String getDiscriminatorAlias (String suffix)

Get the result set aliases used for the identifier columns, given a suffix

public String getDiscriminatorColumnName ()

public String getDiscriminatorColumnReaderTemplate ()

public String getDiscriminatorColumnReaders ()

public EntityMetamodel getEntityMetamodel ()

Retrieve the underlying entity metamodel instance...

Returns
  • The metamodel

public final String getEntityName ()

The entity name which this persister maps.

Returns
  • The name of the entity which this persister maps.

public EntityType getEntityType ()

public SessionFactoryImplementor getFactory ()

Return the SessionFactory to which this persister "belongs".

Returns
  • The owning SessionFactory.

public FetchMode getFetchMode (int i)

May this (subclass closure) property be fetched using an SQL outerjoin?

public Serializable getIdentifier (Object object, EntityMode entityMode)

Get the identifier of an instance (throw an exception if no identifier property)

public Serializable getIdentifier (Object entity, SessionImplementor session)

Get the identifier of an instance (throw an exception if no identifier property)

Parameters
entity The entity for which to get the identifier
session The session from which the request originated
Returns
  • The identifier

public String[] getIdentifierAliases (String suffix)

Get the result set aliases used for the identifier columns, given a suffix

public String[] getIdentifierColumnNames ()

Get the names of columns used to persist the identifier

public String[] getIdentifierColumnReaderTemplates ()

public String[] getIdentifierColumnReaders ()

public IdentifierGenerator getIdentifierGenerator ()

Determine which identifier generation strategy is used for this entity.

Returns
  • The identifier generation strategy.

public String getIdentifierPropertyName ()

Get the name of the identifier property (or return null) - need not return the name of an actual Java property

public Type getIdentifierType ()

Get the identifier type

public String getIdentitySelectString ()

Get the database-specific SQL command to retrieve the last generated IDENTITY value.

Returns
  • The SQL command string

public String[] getKeyColumnNames ()

The columns to join on

public final Class getMappedClass (EntityMode entityMode)

The persistent class, or null

public String getMappedSuperclass ()

Get the class that this class is mapped as a subclass of - not necessarily the direct superclass

public String getName ()

An identifying name; a class name or collection role name.

public int[] getNaturalIdentifierProperties ()

If the entity defines a natural id (hasNaturalIdentifier()), which properties make up the natural id.

Returns
  • The indices of the properties making of the natural id; or null, if no natural id is defined.

public Object[] getNaturalIdentifierSnapshot (Serializable id, SessionImplementor session)

Retrieve the current state of the natural-id properties from the database.

Parameters
id The identifier of the entity for which to retrieve the natural-id values.
session The session from which the request originated.
Returns
  • The natural-id snapshot.

public boolean[] getNonLazyPropertyUpdateability ()

public String[] getPropertyAliases (String suffix, int i)

Get the result set aliases used for the property columns, given a suffix (properties of this class, only).

public CascadeStyle[] getPropertyCascadeStyles ()

Get the cascade styles of the properties (optional operation)

public boolean[] getPropertyCheckability ()

Get the "checkability" of the properties of this class (is the property dirty checked, does the cache need to be updated)

public String[] getPropertyColumnNames (String propertyName)

Get the column names for the given property path

public String[] getPropertyColumnNames (int i)

Get the result set column names mapped for this property (properties of this class, only).

public String[] getPropertyColumnWriters (int i)

public int getPropertyIndex (String propertyName)

Get the property number of the unique key property

public ValueInclusion[] getPropertyInsertGenerationInclusions ()

Which of the properties of this class are database generated values on insert?

public boolean[] getPropertyInsertability ()

Get the "insertability" of the properties of this class (does the property appear in an SQL INSERT)

public boolean[] getPropertyLaziness ()

Get the "laziness" of the properties of this class

public String[] getPropertyNames ()

Get the names of the class properties - doesn't have to be the names of the actual Java properties (used for XML generation only)

public boolean[] getPropertyNullability ()

Get the nullability of the properties of this class

public Type getPropertyType (String propertyName)

Get the type of a particular property by name.

Parameters
propertyName The name of the property for which to retrieve the type.
Returns
  • The type.

public Type[] getPropertyTypes ()

Get the Hibernate types of the class properties

public boolean[] getPropertyUniqueness ()

public ValueInclusion[] getPropertyUpdateGenerationInclusions ()

Which of the properties of this class are database generated values on update?

public boolean[] getPropertyUpdateability ()

Get the "updateability" of the properties of this class (does the property appear in an SQL UPDATE)

public Object getPropertyValue (Object object, int i, EntityMode entityMode)

Get the value of a particular property

public Object getPropertyValue (Object object, String propertyName, EntityMode entityMode)

Get the value of a particular property

public Object[] getPropertyValues (Object object, EntityMode entityMode)

Return the (loaded) values of the mapped properties of the object (not including backrefs)

public Object[] getPropertyValuesToInsert (Object object, Map mergeMap, SessionImplementor session)

Return the values of the insertable properties of the object (including backrefs)

public boolean[] getPropertyVersionability ()

Get the "versionability" of the properties of this class (is the property optimistic-locked)

public Serializable[] getQuerySpaces ()

Returns an array of objects that identify spaces in which properties of this entity are persisted, for instances of this class and its subclasses.

Much like getPropertySpaces(), except that here we include subclass entity spaces.

Returns
  • The query spaces.

public String getRootEntityName ()

Returns an object that identifies the space in which identifiers of this entity hierarchy are unique. Might be a table name, a JNDI URL, etc.

Returns
  • The root entity name.

public String getRootTableAlias (String drivingAlias)

Get the SQL alias this persister would use for the root table given the passed driving alias.

Parameters
drivingAlias The driving alias; or the alias for the table mapped by this persister in the hierarchy.
Returns
  • The root table alias.

public String[] getRootTableIdentifierColumnNames ()

Get the names of columns on the root table used to persist the identifier.

Returns
  • The root table identifier column names.

public String[] getRootTableKeyColumnNames ()

The names of the primary key columns in the root table.

Returns
  • The primary key column names.

public String getRootTableName ()

Locks are always applied to the "root table".

Returns
  • The root table name

public String getSelectByUniqueKeyString (String propertyName)

Get a SQL select string that performs a select based on a unique key determined by the given property name).

Parameters
propertyName The name of the property which maps to the column(s) to use in the select statement restriction.
Returns
  • The SQL select string

public String[] getSubclassColumnReaderTemplateClosure ()

public EntityPersister getSubclassEntityPersister (Object instance, SessionFactoryImplementor factory, EntityMode entityMode)

A request has already identified the entity-name of this persister as the mapping for the given instance. However, we still need to account for possible subclassing and potentially re-route to the more appropriate persister.

For example, a request names Animal as the entity-name which gets resolved to this persister. But the actual instance is really an instance of Cat which is a subclass of Animal. So, here the Animal persister is being asked to return the persister specific to Cat.

It is also possible that the instance is actually an Animal instance in the above example in which case we would return this from this method.

Parameters
instance The entity instance
factory Reference to the SessionFactory
entityMode The entity mode represented by the entity instance.
Returns
  • The appropriate persister

public String[] getSubclassPropertyColumnAliases (String propertyName, String suffix)

Return the column alias names used to persist/query the named property of the class or a subclass (optional operation).

public String[] getSubclassPropertyColumnNames (int i)

Return the column names used to persist the numbered property of the class or a subclass.

public String[] getSubclassPropertyColumnNames (String propertyName)

Return the column names used to persist/query the named property of the class or a subclass (optional operation).

public String[][] getSubclassPropertyColumnReaderClosure ()

public String[][] getSubclassPropertyColumnReaderTemplateClosure ()

public Queryable.Declarer getSubclassPropertyDeclarer (String propertyPath)

Determine whether the given property is declared by our mapped class, our super class, or one of our subclasses...

Note: the method is called 'subclass property...' simply for consistency sake (e.g. getSubclassPropertyTableNumber(String)

Parameters
propertyPath The property name.
Returns
  • The property declarer

public String getSubclassPropertyName (int i)

Get the name of the numbered property of the class or a subclass.

public int getSubclassPropertyTableNumber (String propertyPath)

Warning: When there are duplicated property names in the subclasses of the class, this method may return the wrong table number for the duplicated subclass property (note that SingleTableEntityPersister defines an overloaded form which takes the entity name.

Parameters
propertyPath The name of the property.
Returns
  • The nunber of the table to which the property is mapped.

public Type getSubclassPropertyType (int i)

Get the type of the numbered property of the class or a subclass.

public abstract String getSubclassTableName (int j)

Get the name of the table with the given index from the internal array.

Parameters
j The index into the internal array.

public String getTemporaryIdTableDDL ()

Get the appropriate DDL command for generating the temporary table to be used to (potentially) store id values when performing bulk update/deletes.

Returns
  • The appropriate temporary table creation command.

public String getTemporaryIdTableName ()

Get the name of the temporary table to be used to (potentially) store id values when performing bulk update/deletes.

Returns
  • The appropriate temporary table name.

public Type getType ()

Get the type of the thing containing the properties

public DiscriminatorMetadata getTypeDiscriminatorMetadata ()

Retrieve the information needed to properly deal with this entity's discriminator in a query.

Returns
  • The entity discriminator metadata

public Object getVersion (Object object, EntityMode entityMode)

Get the version number (or timestamp) from the object's version property (or return null if not versioned)

public String getVersionColumnName ()

For versioned entities, get the name of the column (again, expected on the root table) used to store the version values.

Returns
  • The version column name.

public Comparator getVersionComparator ()

Get the comparator used to compare two different version values.

May return null if isVersioned() returns false.

public int getVersionProperty ()

If isVersioned(), then what is the index of the property holding the locking value.

Returns
  • The type of the version property; or -66, if not versioned.

public VersionType getVersionType ()

If isVersioned(), then what is the type of the property holding the locking value.

Returns
  • The type of the version property; or null, if not versioned.

public EntityMode guessEntityMode (Object object)

Try to discover the entity mode from the entity instance

public boolean hasCache ()

Does this class have a cache.

public boolean hasCascades ()

Determine whether this entity has any non-none cascading.

Returns
  • True if the entity has any properties with a cascade other than NONE; false otherwise (aka, no cascading).

public boolean hasCollections ()

Determine whether this entity contains references to persistent collections.

Returns
  • True if the entity does contain persistent collections; false otherwise.

public boolean hasIdentifierProperty ()

Determine whether the entity has a particular property holding the identifier value.

Returns
  • True if the entity has a specific property holding identifier value.

public boolean hasInsertGeneratedProperties ()

Does this entity define any properties as being database generated on insert?

Returns
  • True if this entity contains at least one property defined as generated (including version property, but not identifier).

public boolean hasLazyProperties ()

Determine whether this entity defines any lazy properties (ala bytecode instrumentation).

Returns
  • True if the entity has properties mapped as lazy; false otherwise.

public boolean hasMutableProperties ()

Determine whether any properties of this entity are considered mutable.

Returns
  • True if any properties of the entity are mutable; false otherwise (meaning none are).

public boolean hasNaturalIdentifier ()

Determine whether this entity defines a natural identifier.

Returns
  • True if the entity defines a natural id; false otherwise.

public boolean hasProxy ()

Determine whether this entity supports dynamic proxies.

Returns
  • True if the entity has dynamic proxy support; false otherwise.

public boolean hasRowId ()

Does the result set contain rowids?

public boolean hasSequentialSelect ()

public boolean hasSubclasses ()

Does this entity have mapped subclasses?

public boolean hasSubselectLoadableCollections ()

Determine whether this entity contains references to persistent collections which are fetchable by subselect?

Returns
  • True if the entity contains collections fetchable by subselect; false otherwise.

public boolean hasUninitializedLazyProperties (Object object, EntityMode entityMode)

Does the given instance have any uninitialized lazy properties?

public boolean hasUpdateGeneratedProperties ()

Does this entity define any properties as being database generated on update?

Returns
  • True if this entity contains at least one property defined as generated (including version property, but not identifier).

public Object[] hydrate (ResultSet rs, Serializable id, Object object, Loadable rootLoadable, String[][] suffixedPropertyColumns, boolean allProperties, SessionImplementor session)

Unmarshall the fields of a persistent instance from a result set, without resolving associations or collections. Question: should this really be here, or should it be sent back to Loader?

public String identifierSelectFragment (String name, String suffix)

Given a query alias and an identifying suffix, render the intentifier select fragment.

public boolean implementsLifecycle (EntityMode entityMode)

Does the class implement the Lifecycle interface.

public boolean implementsValidatable (EntityMode entityMode)

Does the class implement the Validatable interface.

public Object initializeLazyProperty (String fieldName, Object entity, SessionImplementor session)

Initialize the property, and return its new value

public void insert (Serializable id, Object[] fields, Object object, SessionImplementor session)

Persist an instance

public Serializable insert (Object[] fields, Object object, SessionImplementor session)

Persist an instance, using a natively generated identifier (optional operation)

public Object instantiate (Serializable id, EntityMode entityMode)

Create a class instance initialized with the given identifier

public Object instantiate (Serializable id, SessionImplementor session)

Create a class instance initialized with the given identifier

Parameters
id The identifier value to use (may be null to represent no value)
session The session from which the request originated.
Returns
  • The instantiated entity.

public boolean isAbstract ()

Is this an abstract class?

public boolean isBatchLoadable ()

Is batch loading enabled?

public boolean isBatchable ()

public boolean isCacheInvalidationRequired ()

We can't immediately add to the cache if we have formulas which must be evaluated, or if we have the possibility of two concurrent updates to the same item being merged on the database. This can happen if (a) the item is not versioned and either (b) we have dynamic update enabled or (c) we have multiple tables holding the state of the item.

public boolean isCollection ()

Is this instance actually a CollectionPersister?

public boolean isDefinedOnSubclass (int i)

Is this property defined on a subclass of the mapped class.

public boolean isExplicitPolymorphism ()

Is this class explicit polymorphism only?

public boolean isIdentifierAssignedByInsert ()

Are identifiers of this entity assigned known before the insert execution? Or, are they generated (in the database) by the insert execution.

Returns
  • True if identifiers for this entity are generated by the insert execution.

public boolean isInherited ()

Determine whether the entity is inherited one or more other entities. In other words, is this entity a subclass of other entities.

Returns
  • True if other entities extend this entity; false otherwise.

public boolean isInstance (Object object, EntityMode entityMode)

Is the given object an instance of this entity?

public boolean isInstrumented (EntityMode entityMode)

Has the class actually been bytecode instrumented?

public boolean isLazyPropertiesCacheable ()

Should lazy properties of this entity be cached?

public boolean isMultiTable ()

Is the inheritence hierarchy described by this persister contained across multiple tables?

Returns
  • True if the inheritence hierarchy is spread across multiple tables; false otherwise.

public boolean isMutable ()

Determine whether instances of this entity are considered mutable.

Returns
  • True if the entity is considered mutable; false otherwise.

public boolean isPolymorphic ()

public boolean isSelectBeforeUpdateRequired ()

Is select snapshot before update enabled?

public boolean isSubclassEntityName (String entityName)

Determine whether the given name represents a subclass entity (or this entity itself) of the entity mapped by this persister.

Parameters
entityName The entity name to be checked.
Returns
  • True if the given entity name represents either the entity mapped by this persister or one of its subclass entities; false otherwise.

public boolean isSubclassPropertyNullable (int i)

Is the numbered property of the class of subclass nullable?

public Boolean isTransient (Object entity, SessionImplementor session)

Is this a new transient instance?

public boolean isVersionPropertyGenerated ()

Does this entity contain a version property that is defined to be database generated?

Returns
  • true if this entity contains a version property and that property has been marked as generated.

public boolean isVersionPropertyInsertable ()

Is the version property included in insert statements?

public boolean isVersioned ()

Determine whether optimistic locking by column is enabled for this entity.

Returns
  • True if optimistic locking by column (i.e., or ) is enabled; false otherwise.

public Object load (Serializable id, Object optionalObject, LockOptions lockOptions, SessionImplementor session)

Load an instance using either the forUpdateLoader or the outer joining loader, depending upon the value of the lock parameter

public Object load (Serializable id, Object optionalObject, LockMode lockMode, SessionImplementor session)

Load an instance using either the forUpdateLoader or the outer joining loader, depending upon the value of the lock parameter

public Object loadByUniqueKey (String propertyName, Object uniqueKey, SessionImplementor session)

Load an instance of the persistent class, by a unique key other than the primary key.

public void lock (Serializable id, Object version, Object object, LockOptions lockOptions, SessionImplementor session)

Do a version check (optional operation)

public void lock (Serializable id, Object version, Object object, LockMode lockMode, SessionImplementor session)

Do a version check (optional operation)

public String oneToManyFilterFragment (String alias)

public void postInstantiate ()

Finish the initialization of this object.

Called only once per SessionFactory lifecycle, after all entity persisters have been instantiated.

public void processInsertGeneratedProperties (Serializable id, Object entity, Object[] state, SessionImplementor session)

Perform a select to retrieve the values of any generated properties back from the database, injecting these generated values into the given entity as well as writing this state to the PersistenceContext.

Note, that because we update the PersistenceContext here, callers need to take care that they have already written the initial snapshot to the PersistenceContext before calling this method.

Parameters
id The entity's id value.
entity The entity for which to get the state.
session The session

public void processUpdateGeneratedProperties (Serializable id, Object entity, Object[] state, SessionImplementor session)

Perform a select to retrieve the values of any generated properties back from the database, injecting these generated values into the given entity as well as writing this state to the PersistenceContext.

Note, that because we update the PersistenceContext here, callers need to take care that they have already written the initial snapshot to the PersistenceContext before calling this method.

Parameters
id The entity's id value.
entity The entity for which to get the state.
session The session

public String propertySelectFragment (String tableAlias, String suffix, boolean allProperties)

Given a query alias and an identifying suffix, render the property select fragment.

public SelectFragment propertySelectFragmentFragment (String tableAlias, String suffix, boolean allProperties)

public void registerAffectingFetchProfile (String fetchProfileName)

Register the name of a fetch profile determined to have an affect on the underlying loadable in regards to the fact that the underlying load SQL needs to be adjust when the given fetch profile is enabled.

Parameters
fetchProfileName The name of the profile affecting this.

public void resetIdentifier (Object entity, Serializable currentId, Object currentVersion, SessionImplementor session)

Set the identifier and version of the given instance back to its "unsaved" value.

Parameters
entity The entity instance
currentId The currently assigned identifier value.
currentVersion The currently assigned version value.
session The session from which the request originated.

public void resetIdentifier (Object entity, Serializable currentId, Object currentVersion, EntityMode entityMode)

Set the identifier and version of the given instance back to its "unsaved" value.

Parameters
entity The entity instance
currentId The currently assigned identifier value.
currentVersion The currently assigned version value.
entityMode The entity mode represented by the entity instance.

public String selectFragment (String alias, String suffix)

Generate a list of collection index, key and element columns

public final String selectFragment (Joinable rhs, String rhsAlias, String lhsAlias, String entitySuffix, String collectionSuffix, boolean includeCollectionColumns)

All columns to select, when loading.

public void setIdentifier (Object entity, Serializable id, SessionImplementor session)

Inject the identifier value into the given entity.

Parameters
entity The entity to inject with the identifier value.
id The value to be injected as the identifier.
session The session from which is requests originates

public void setIdentifier (Object entity, Serializable id, EntityMode entityMode)

Inject the identifier value into the given entity.

Has no effect if the entity does not define an identifier property

Parameters
entity The entity to inject with the identifier value.
id The value to be injected as the identifier.
entityMode The entity mode

public void setPropertyValue (Object object, String propertyName, Object value, EntityMode entityMode)

Set the value of a particular (named) property

public void setPropertyValue (Object object, int i, Object value, EntityMode entityMode)

Set the value of a particular property

public void setPropertyValues (Object object, Object[] values, EntityMode entityMode)

Set the given values to the mapped properties of the given object

public String[] toColumns (String name, int i)

Given the number of a property of a subclass, and a table alias, return the aliased column names.

public String[] toColumns (String alias, String propertyName)

Given a query alias and a property path, return the qualified column name

public String[] toColumns (String propertyName)

Given a property path, return the corresponding column name(s).

public String toString ()

public Type toType (String propertyName)

Given a component path expression, get the type of the property

public void update (Serializable id, Object[] fields, int[] dirtyFields, boolean hasDirtyCollection, Object[] oldFields, Object oldVersion, Object object, Object rowId, SessionImplementor session)

Update an object

public String whereJoinFragment (String alias, boolean innerJoin, boolean includeSubclasses)

Get the where clause part of any joins (optional operation)

Protected Methods

protected void addDiscriminatorToInsert (Insert insert)

protected void addDiscriminatorToSelect (SelectFragment select, String name, String suffix)

protected boolean check (int rows, Serializable id, int tableNumber, Expectation expectation, PreparedStatement statement)

protected String concretePropertySelectFragment (String alias, AbstractEntityPersister.InclusionChecker inclusionChecker)

protected String concretePropertySelectFragment (String alias, boolean[] includeProperty)

protected String concretePropertySelectFragment (String alias, ValueInclusion[] inclusions)

protected String concretePropertySelectFragmentSansLeadingComma (String alias, boolean[] include)

protected UniqueEntityLoader createEntityLoader (LockMode lockMode, LoadQueryInfluencers loadQueryInfluencers)

protected UniqueEntityLoader createEntityLoader (LockMode lockMode)

protected UniqueEntityLoader createEntityLoader (LockOptions lockOptions, LoadQueryInfluencers loadQueryInfluencers)

protected String createFrom (int tableNumber, String alias)

protected JoinFragment createJoin (String name, boolean innerJoin, boolean includeSubclasses)

protected JoinFragment createJoin (int[] tableNumbers, String drivingAlias)

protected void createLoaders ()

protected void createQueryLoader ()

protected SelectFragment createSelect (int[] subclassColumnNumbers, int[] subclassFormulaNumbers)

protected void createUniqueKeyLoaders ()

protected String createWhereByKey (int tableNumber, String alias)

protected int dehydrate (Serializable id, Object[] fields, boolean[] includeProperty, boolean[][] includeColumns, int j, PreparedStatement st, SessionImplementor session)

protected int dehydrate (Serializable id, Object[] fields, Object rowId, boolean[] includeProperty, boolean[][] includeColumns, int j, PreparedStatement ps, SessionImplementor session, int index)

Marshall the fields of a persistent instance to a prepared statement

protected void delete (Serializable id, Object version, int j, Object object, String sql, SessionImplementor session, Object[] loadedState)

Perform an SQL DELETE

protected abstract String filterFragment (String alias)

protected String generateDeleteString (int j)

Generate the SQL that deletes a row by id (and version)

protected String generateIdentityInsertString (boolean[] includeProperty)

Used to generate an insery statement against the root table in the case of identifier generation strategies where the insert statement executions actually generates the identifier value.

Parameters
includeProperty indices of the properties to include in the insert statement.
Returns
  • The insert SQL statement string

protected String generateInsertGeneratedValuesSelectString ()

protected String generateInsertString (boolean[] includeProperty, int j)

protected String generateInsertString (boolean identityInsert, boolean[] includeProperty)

protected String generateInsertString (boolean identityInsert, boolean[] includeProperty, int j)

Generate the SQL that inserts a row

protected String generateLazySelectString ()

protected LockingStrategy generateLocker (LockMode lockMode)

protected String generateSelectVersionString ()

Generate the SQL that selects the version number by id

protected String generateSnapshotSelectString ()

protected String generateTableAlias (String rootAlias, int tableNumber)

protected String generateUpdateGeneratedValuesSelectString ()

protected String generateUpdateString (boolean[] includeProperty, int j, boolean useRowId)

protected String generateUpdateString (boolean[] includeProperty, int j, Object[] oldFields, boolean useRowId)

Generate the SQL that updates a row by id (and version)

protected String getDiscriminatorAlias ()

protected String getDiscriminatorFormulaTemplate ()

protected String[] getIdentifierAliases ()

protected int getIdentifierColumnSpan ()

protected abstract String[] getKeyColumns (int j)

protected Set getLazyProperties ()

protected Map getLoaders ()

protected boolean[] getPropertiesToInsert (Object[] fields)

Transform the array of property indexes to an array of booleans, true when the property is insertable and non-null

protected final boolean[] getPropertiesToUpdate (int[] dirtyProperties, boolean hasDirtyCollection)

Transform the array of property indexes to an array of booleans, true when the property is dirty

protected boolean[][] getPropertyColumnInsertable ()

protected int getPropertyColumnSpan (int i)

protected boolean[][] getPropertyColumnUpdateable ()

protected boolean[] getPropertySelectable ()

protected int getPropertySpan ()

protected String[] getPropertySubclassNames ()

protected abstract int[] getPropertyTableNumbers ()

protected abstract int[] getPropertyTableNumbersInSelect ()

protected boolean[] getPropertyUpdateability (Object entity, EntityMode entityMode)

Which properties appear in the SQL update? (Initialized, updateable ones!)

protected String[] getSQLDeleteStrings ()

protected String getSQLIdentityInsertString ()

The query that inserts a row, letting the database generate an id

Returns
  • The IDENTITY-based insertion query.

protected String[] getSQLInsertStrings ()

protected String getSQLLazySelectString ()

protected String[] getSQLLazyUpdateByRowIdStrings ()

protected String[] getSQLLazyUpdateStrings ()

protected String getSQLSnapshotSelectString ()

protected String[] getSQLUpdateByRowIdStrings ()

protected String[] getSQLUpdateStrings ()

protected String getSQLWhereString (String alias)

protected String getSequentialSelect (String entityName)

protected String[] getSubclassColumnAliasClosure ()

protected String[] getSubclassColumnClosure ()

protected boolean[] getSubclassColumnLazyiness ()

protected abstract int[] getSubclassColumnTableNumberClosure ()

protected String[] getSubclassFormulaAliasClosure ()

protected String[] getSubclassFormulaClosure ()

protected boolean[] getSubclassFormulaLazyiness ()

protected abstract int[] getSubclassFormulaTableNumberClosure ()

protected String[] getSubclassFormulaTemplateClosure ()

protected String[][] getSubclassPropertyColumnNameClosure ()

protected String[][] getSubclassPropertyFormulaTemplateClosure ()

protected String[] getSubclassPropertyNameClosure ()

protected String[] getSubclassPropertySubclassNameClosure ()

protected abstract int getSubclassPropertyTableNumber (int i)

protected Type[] getSubclassPropertyTypeClosure ()

protected abstract String[] getSubclassTableKeyColumns (int j)

protected abstract int getSubclassTableSpan ()

protected abstract String getTableName (int j)

protected abstract int getTableSpan ()

protected boolean[] getTableUpdateNeeded (int[] dirtyProperties, boolean hasDirtyCollection)

Decide which tables need to be updated.

The return here is an array of boolean values with each index corresponding to a given table in the scope of this persister.

Parameters
dirtyProperties The indices of all the entity properties considered dirty.
hasDirtyCollection Whether any collections owned by the entity which were considered dirty.
Returns
  • Array of booleans indicating which table require updating.

protected EntityTuplizer getTuplizer (EntityMode entityMode)

protected EntityTuplizer getTuplizer (SessionImplementor session)

protected String getVersionSelectString ()

protected String getVersionedTableName ()

protected boolean hasEmbeddedCompositeIdentifier ()

protected boolean hasFormulaProperties ()

protected boolean hasWhere ()

protected void initLockers ()

protected void initPropertyPaths (Mapping mapping)

protected void initSubclassPropertyAliasesMap (PersistentClass model)

Must be called by subclasses, at the end of their constructors

protected void insert (Serializable id, Object[] fields, boolean[] notNull, int j, String sql, Object object, SessionImplementor session)

Perform an SQL INSERT.

This for is used for all non-root tables as well as the root table in cases where the identifier value is known before the insert occurs.

protected Serializable insert (Object[] fields, boolean[] notNull, String sql, Object object, SessionImplementor session)

Perform an SQL INSERT, and then retrieve a generated identifier.

This form is used for PostInsertIdentifierGenerator-style ids (IDENTITY, select, etc).

protected abstract boolean isClassOrSuperclassTable (int j)

protected boolean isDeleteCallable (int j)

protected boolean isInsertCallable (int j)

protected boolean isInverseSubclassTable (int j)

protected boolean isInverseTable (int j)

protected boolean isNullableSubclassTable (int j)

protected boolean isNullableTable (int j)

protected abstract boolean isPropertyOfTable (int property, int j)

protected boolean isSubclassPropertyDeferred (String propertyName, String entityName)

protected boolean isSubclassTableLazy (int j)

protected boolean isSubclassTableSequentialSelect (int j)

protected abstract boolean isTableCascadeDeleteEnabled (int j)

protected boolean isUpdateCallable (int j)

protected void logStaticSQL ()

protected final int optimisticLockMode ()

protected void postConstruct (Mapping mapping)

protected String renderSelect (int[] tableNumbers, int[] columnNumbers, int[] formulaNumbers)

protected boolean update (Serializable id, Object[] fields, Object[] oldFields, Object rowId, boolean[] includeProperty, int j, Object oldVersion, Object object, String sql, SessionImplementor session)

protected void updateOrInsert (Serializable id, Object[] fields, Object[] oldFields, Object rowId, boolean[] includeProperty, int j, Object oldVersion, Object object, String sql, SessionImplementor session)

Perform an SQL UPDATE or SQL INSERT

protected boolean useDynamicInsert ()

protected boolean useDynamicUpdate ()

protected boolean useGetGeneratedKeys ()

protected boolean useInsertSelectIdentity ()