| Prev Class | Next Class | Frames | No Frames |
| Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Objectorg.hibernate.persister.entity.AbstractEntityPersisterpublic abstract class AbstractEntityPersisterextends java.lang.ObjectNested Class Summary | |
protected static interface | |
Field Summary | |
static String | |
protected String[] | |
protected String[] | |
protected String[] | |
protected boolean[] | |
protected ExecuteUpdateResultCheckStyle[] | |
protected boolean[] | |
protected ExecuteUpdateResultCheckStyle[] | |
protected BasicEntityPropertyMapping | |
protected String | |
protected boolean[] | |
protected ExecuteUpdateResultCheckStyle[] | |
Fields inherited from interface org.hibernate.persister.entity.EntityPersister | |
ENTITY_ID | |
Fields inherited from interface org.hibernate.intercept.LazyPropertyInitializer | |
UNFETCHED_PROPERTY | |
Fields inherited from interface org.hibernate.persister.entity.Loadable | |
ROWID_ALIAS | |
Constructor Summary | |
| |
Method Summary | |
protected void |
|
protected void |
|
void |
|
void |
|
boolean |
|
protected boolean |
|
protected String |
|
protected String |
|
protected String |
|
protected String |
|
boolean |
|
boolean |
|
int | |
protected UniqueEntityLoader |
|
protected UniqueEntityLoader |
|
protected String |
|
protected JoinFragment |
|
protected JoinFragment |
|
Object |
|
protected void | |
protected SelectFragment |
|
protected void | |
protected String |
|
protected int |
|
protected int |
|
void |
|
protected void |
|
protected abstract String |
|
String |
|
int[] |
|
int[] |
|
Object |
|
String |
|
protected String |
|
String |
|
protected String |
|
protected String | |
protected String |
|
protected String |
|
protected String |
|
protected String | |
protected LockingStrategy |
|
protected String |
|
protected String | |
protected String |
|
protected String | |
protected String |
|
protected String |
|
EntityRegionAccessStrategy |
|
CacheEntryStructure |
|
CascadeStyle |
|
ClassMetadata |
|
Class |
|
Object |
|
Object[] |
|
protected String | |
String |
|
String | |
protected String | |
EntityMetamodel |
|
String |
|
EntityType | |
SessionFactoryImplementor |
|
FetchMode |
|
Serializable |
|
protected String[] | |
String[] |
|
String[] |
|
protected int | |
IdentifierGenerator |
|
String |
|
Type |
|
String |
|
String[] |
|
protected abstract String[] |
|
protected Set | |
Class |
|
String |
|
String |
|
int[] |
|
Object[] |
|
boolean[] | |
protected boolean[] |
|
protected boolean[] |
|
String[] |
|
CascadeStyle[] |
|
boolean[] |
|
String[] |
|
String[] |
|
protected int |
|
int |
|
ValueInclusion[] |
|
boolean[] |
|
boolean[] |
|
String[] |
|
boolean[] |
|
protected int | |
protected String[] | |
protected abstract int[] | |
protected abstract int[] | |
Type |
|
Type[] |
|
ValueInclusion[] |
|
boolean[] |
|
protected boolean[] |
|
Object |
|
Object |
|
Object[] |
|
Object[] |
|
boolean[] |
|
Serializable[] |
|
String |
|
String |
|
String[] |
|
String[] |
|
String |
|
protected String[] | |
protected String |
|
protected String[] | |
protected String | |
protected String[] | |
protected String[] | |
protected String | |
protected String[] | |
protected String[] | |
protected String |
|
String |
|
protected String |
|
protected String[] | |
protected String[] | |
protected boolean[] | |
protected abstract int[] | |
EntityPersister |
|
protected String[] | |
protected String[] | |
protected boolean[] | |
protected abstract int[] | |
protected String[] | |
String[] |
|
protected String[][] | |
String[] |
|
String[] | |
Declarer |
|
protected String[][] | |
String |
|
protected String[] | |
protected String[] | |
int |
|
protected abstract int | |
Type |
|
protected Type[] | |
protected abstract String[] |
|
abstract String |
|
protected abstract int | |
protected abstract String |
|
protected abstract int | |
protected boolean[] |
|
String |
|
String |
|
protected EntityTuplizer |
|
protected EntityTuplizer |
|
Type |
|
Object |
|
String |
|
Comparator | |
int |
|
protected String | |
VersionType |
|
protected String | |
EntityMode |
|
boolean |
|
boolean |
|
boolean |
|
protected boolean | |
protected boolean | |
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean | |
boolean |
|
boolean |
|
boolean |
|
boolean |
|
protected boolean |
|
Object[] |
|
String |
|
boolean |
|
boolean |
|
protected void | |
protected void |
|
protected void |
|
Object |
|
Serializable |
|
protected Serializable |
|
void |
|
protected void |
|
Object |
|
boolean |
|
boolean |
|
boolean | |
boolean |
|
protected abstract boolean |
|
boolean |
|
boolean |
|
protected boolean |
|
boolean |
|
boolean |
|
boolean |
|
protected boolean |
|
boolean |
|
boolean |
|
protected boolean |
|
protected boolean |
|
boolean |
|
boolean |
|
boolean |
|
protected boolean |
|
protected boolean |
|
boolean | |
protected abstract boolean |
|
boolean |
|
boolean |
|
protected boolean |
|
boolean |
|
protected boolean |
|
protected boolean | |
protected abstract boolean |
|
Boolean |
|
protected boolean |
|
boolean |
|
boolean |
|
boolean |
|
Object |
|
Object |
|
void |
|
protected void | |
String |
|
protected int | |
protected void |
|
void |
|
void |
|
void |
|
String |
|
protected String |
|
void |
|
String |
|
String |
|
void |
|
void |
|
void |
|
void |
|
String[] |
|
String[] |
|
String[] |
|
String |
|
Type |
|
protected boolean |
|
void |
|
protected void |
|
protected boolean | |
protected boolean | |
protected boolean | |
protected boolean | |
String |
|
public static final String ENTITY_CLASS
protected String[] customSQLDelete
protected String[] customSQLInsert
protected String[] customSQLUpdate
protected boolean[] deleteCallable
protected boolean[] insertCallable
protected final String rowIdName
protected boolean[] updateCallable
public AbstractEntityPersister(PersistentClass persistentClass, EntityRegionAccessStrategy cacheAccessStrategy, SessionFactoryImplementor factory) throws HibernateException
protected void addDiscriminatorToSelect(SelectFragment select, String name, String suffix)
public void afterInitialize(Object entity,
boolean lazyPropertiesAreUnfetched,
SessionImplementor session)Called just after the entities properties have been initialized
- Specified by:
- afterInitialize in interface EntityPersister
public void afterReassociate(Object entity,
SessionImplementor session)Called just after the entity has been reassociated with the session
- Specified by:
- afterReassociate in interface EntityPersister
public boolean canExtractIdOutOfEntity()
Determine whether detahced instances of this entity carry their own identifier value. The other option is the deperecated feature where users could supply the id during session calls.
- Specified by:
- canExtractIdOutOfEntity in interface EntityPersister
- Returns:
- True if either (1)
EntityPersister.hasIdentifierProperty()or (2) the identifier is an embedded composite identifier; false otherwise.
protected boolean check(int rows,
Serializable id,
int tableNumber,
Expectation expectation,
PreparedStatement statement)
throws HibernateExceptionprotected String concretePropertySelectFragment(String alias,
boolean[] includeProperty)protected String concretePropertySelectFragment(String alias,
ValueInclusion[] inclusions)protected String concretePropertySelectFragment(String alias,
AbstractEntityPersister.InclusionChecker inclusionChecker)protected String concretePropertySelectFragmentSansLeadingComma(String alias,
boolean[] include)public boolean consumesCollectionAlias()
Very, very, very ugly...
- Specified by:
- consumesCollectionAlias in interface Joinable
- Returns:
- Does this persister "consume" collection column aliases in the result set?
public boolean consumesEntityAlias()
Very, very, very ugly...
- Specified by:
- consumesEntityAlias in interface Joinable
- Returns:
- Does this persister "consume" entity column aliases in the result set?
public int countSubclassProperties()
- Specified by:
- countSubclassProperties in interface OuterJoinLoadable
protected UniqueEntityLoader createEntityLoader(LockMode lockMode) throws MappingException
protected UniqueEntityLoader createEntityLoader(LockMode lockMode, Map enabledFilters) throws MappingException
protected String createFrom(int tableNumber,
String alias)protected JoinFragment createJoin(String name, boolean innerJoin, boolean includeSubclasses)
public Object createProxy(Serializable id,
SessionImplementor session)
throws HibernateExceptionCreate a new proxy instance
- Specified by:
- createProxy in interface EntityPersister
protected void createQueryLoader()
protected SelectFragment createSelect(int[] subclassColumnNumbers, int[] subclassFormulaNumbers)
protected String createWhereByKey(int tableNumber,
String alias)protected int dehydrate(Serializable id,
Object[] fields,
Object rowId,
boolean[] includeProperty,
boolean[][] includeColumns,
int j,
PreparedStatement ps,
SessionImplementor session,
int index)
throws SQLException,
HibernateExceptionMarshall the fields of a persistent instance to a prepared statement
protected int dehydrate(Serializable id,
Object[] fields,
boolean[] includeProperty,
boolean[][] includeColumns,
int j,
PreparedStatement st,
SessionImplementor session)
throws HibernateException,
SQLExceptionpublic void delete(Serializable id,
Object version,
Object object,
SessionImplementor session)
throws HibernateExceptionDelete an object
- Specified by:
- delete in interface EntityPersister
protected void delete(Serializable id,
Object version,
int j,
Object object,
String sql,
SessionImplementor session,
Object[] loadedState)
throws HibernateExceptionPerform an SQL DELETE
public String filterFragment(String alias,
Map enabledFilters)
throws MappingExceptionGet the where clause filter, given a query alias and considering enabled session filters
- Specified by:
- filterFragment in interface Joinable
public int[] findDirty(Object[] currentState,
Object[] previousState,
Object entity,
SessionImplementor session)
throws HibernateExceptionLocate the property-indices of all properties considered to be dirty.
- Specified by:
- findDirty in interface EntityPersister
- 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
- Throws:
HibernateException-
public int[] findModified(Object[] old,
Object[] current,
Object entity,
SessionImplementor session)
throws HibernateExceptionLocate the property-indices of all properties considered to be dirty.
- Specified by:
- findModified in interface EntityPersister
- 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
- Throws:
HibernateException-
public Object forceVersionIncrement(Serializable id,
Object currentVersion,
SessionImplementor session)
- Specified by:
- forceVersionIncrement in interface EntityPersister
public String fromJoinFragment(String alias,
boolean innerJoin,
boolean includeSubclasses)Get the from clause part of any joins (optional operation)
- Specified by:
- fromJoinFragment in interface Joinable
protected String generateDeleteString(int j)
Generate the SQL that deletes a row by id (and version)
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.
- Specified by:
- generateFilterConditionAlias in interface Queryable
- Parameters:
rootAlias- The root alias
- Returns:
- The alias used for "filter conditions" within the where clause.
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 identityInsert,
boolean[] includeProperty)protected String generateInsertString(boolean identityInsert,
boolean[] includeProperty,
int j)Generate the SQL that inserts a row
protected String generateInsertString(boolean[] includeProperty,
int j)protected String generateLazySelectString()
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,
Object[] oldFields,
boolean useRowId)Generate the SQL that updates a row by id (and version)
protected String generateUpdateString(boolean[] includeProperty,
int j,
boolean useRowId)public EntityRegionAccessStrategy getCacheAccessStrategy()
Get the cache (optional operation)
- Specified by:
- getCacheAccessStrategy in interface EntityPersister
public CacheEntryStructure getCacheEntryStructure()
Get the cache structure
- Specified by:
- getCacheEntryStructure in interface EntityPersister
public CascadeStyle getCascadeStyle(int i)
- Specified by:
- getCascadeStyle in interface OuterJoinLoadable
public ClassMetadata getClassMetadata()
Get the user-visible metadata for the class (optional operation)
- Specified by:
- getClassMetadata in interface EntityPersister
public Class getConcreteProxyClass(EntityMode entityMode)
Get the proxy interface that instances of this concrete class will be cast to (optional operation).
- Specified by:
- getConcreteProxyClass in interface EntityPersister
public Object getCurrentVersion(Serializable id,
SessionImplementor session)
throws HibernateExceptionRetrieve the version number
- Specified by:
- getCurrentVersion in interface EntityPersister
public Object[] getDatabaseSnapshot(Serializable id,
SessionImplementor session)
throws HibernateExceptionGet the current database state of the object, in a "hydrated" form, without resolving identifiers
- Specified by:
- getDatabaseSnapshot in interface EntityPersister
- Returns:
- null if there is no row in the database
protected String getDiscriminatorAlias()
public String getDiscriminatorAlias(String suffix)
- Specified by:
- getDiscriminatorAlias in interface Loadable
public String getDiscriminatorColumnName()
- Specified by:
- getDiscriminatorColumnName in interface Loadable
protected String getDiscriminatorFormulaTemplate()
public EntityMetamodel getEntityMetamodel()
Retrieve the underlying entity metamodel instance...
- Specified by:
- getEntityMetamodel in interface EntityPersister
- Returns:
- The metamodel
public final String getEntityName()
The name of the entity
- Specified by:
- getEntityName in interface EntityPersister
- getEntityName in interface ClassMetadata
public EntityType getEntityType()
- Specified by:
- getEntityType in interface OuterJoinLoadable
public SessionFactoryImplementor getFactory()
Return the SessionFactory to which this persister "belongs".
- Specified by:
- getFactory in interface EntityPersister
- Returns:
- The owning SessionFactory.
public FetchMode getFetchMode(int i)
- Specified by:
- getFetchMode in interface OuterJoinLoadable
public Serializable getIdentifier(Object object,
EntityMode entityMode)
throws HibernateExceptionGet the identifier of an instance (throw an exception if no identifier property)
- Specified by:
- getIdentifier in interface EntityPersister
- getIdentifier in interface ClassMetadata
protected String[] getIdentifierAliases()
public String[] getIdentifierAliases(String suffix)
- Specified by:
- getIdentifierAliases in interface Loadable
public String[] getIdentifierColumnNames()
Get the names of columns used to persist the identifier
- Specified by:
- getIdentifierColumnNames in interface Loadable
- getIdentifierColumnNames in interface Queryable
protected int getIdentifierColumnSpan()
public IdentifierGenerator getIdentifierGenerator() throws HibernateException
Determine which identifier generation strategy is used for this entity.
- Specified by:
- getIdentifierGenerator in interface EntityPersister
- Returns:
- The identifier generation strategy.
public String getIdentifierPropertyName()
Get the name of the identifier property (or return null)
- Specified by:
- getIdentifierPropertyName in interface EntityPersister
- getIdentifierPropertyName in interface ClassMetadata
public Type getIdentifierType()
Get the identifier Hibernate type
- Specified by:
- getIdentifierType in interface EntityPersister
- getIdentifierType in interface ClassMetadata
public String getIdentitySelectString()
Get the database-specific SQL command to retrieve the last generated IDENTITY value.
- Specified by:
- getIdentitySelectString in interface PostInsertIdentityPersister
- Returns:
- The SQL command string
public String[] getKeyColumnNames()
The columns to join on
- Specified by:
- getKeyColumnNames in interface Joinable
protected abstract String[] getKeyColumns(int j)
protected Set getLazyProperties()
public final Class getMappedClass(EntityMode entityMode)
The persistent class, or null
- Specified by:
- getMappedClass in interface EntityPersister
- getMappedClass in interface ClassMetadata
public String getMappedSuperclass()
Get the class that this class is mapped as a subclass of - not necessarily the direct superclass
- Specified by:
- getMappedSuperclass in interface Queryable
public String getName()
An identifying name; a class name or collection role name.
public int[] getNaturalIdentifierProperties()
Which properties hold the natural id?
- Specified by:
- getNaturalIdentifierProperties in interface EntityPersister
- getNaturalIdentifierProperties in interface ClassMetadata
public Object[] getNaturalIdentifierSnapshot(Serializable id,
SessionImplementor session)
throws HibernateExceptionRetrieve the current state of the natural-id properties from the database.
- Specified by:
- getNaturalIdentifierSnapshot in interface EntityPersister
- Parameters:
id- The identifier of the entity for which to retrieve the naturak-id values.session- The session from which the request originated.
- Returns:
- The natural-id snapshot.
public boolean[] getNonLazyPropertyUpdateability()
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
public String[] getPropertyAliases(String suffix,
int i)
- Specified by:
- getPropertyAliases in interface Loadable
public CascadeStyle[] getPropertyCascadeStyles()
Get the cascade styles of the propertes (optional operation)
- Specified by:
- getPropertyCascadeStyles in interface EntityPersister
public boolean[] getPropertyCheckability()
Get the "checkability" of the properties of this class (is the property dirty checked, does the cache need to be updated)
- Specified by:
- getPropertyCheckability in interface EntityPersister
public String[] getPropertyColumnNames(String propertyName)
- Specified by:
- getPropertyColumnNames in interface OuterJoinLoadable
public String[] getPropertyColumnNames(int i)
- Specified by:
- getPropertyColumnNames in interface Loadable
protected int getPropertyColumnSpan(int i)
public int getPropertyIndex(String propertyName)
Get the property number of the unique key property
- Specified by:
- getPropertyIndex in interface UniqueKeyLoadable
public ValueInclusion[] getPropertyInsertGenerationInclusions()
Which of the properties of this class are database generated values on insert?
- Specified by:
- getPropertyInsertGenerationInclusions in interface EntityPersister
public boolean[] getPropertyInsertability()
Get the "insertability" of the properties of this class (does the property appear in an SQL INSERT)
- Specified by:
- getPropertyInsertability in interface EntityPersister
public boolean[] getPropertyLaziness()
Get the "laziness" of the properties of this class
- Specified by:
- getPropertyLaziness in interface EntityPersister
- getPropertyLaziness in interface ClassMetadata
public String[] getPropertyNames()
Get the names of the class' persistent properties
- Specified by:
- getPropertyNames in interface EntityPersister
- getPropertyNames in interface ClassMetadata
public boolean[] getPropertyNullability()
Get the nullability of the class' persistent properties
- Specified by:
- getPropertyNullability in interface EntityPersister
- getPropertyNullability in interface ClassMetadata
protected int getPropertySpan()
protected String[] getPropertySubclassNames()
protected abstract int[] getPropertyTableNumbers()
protected abstract int[] getPropertyTableNumbersInSelect()
public Type getPropertyType(String propertyName) throws MappingException
Get the type of a particular (named) property
- Specified by:
- getPropertyType in interface EntityPersister
- getPropertyType in interface ClassMetadata
public Type[] getPropertyTypes()
Get the Hibernate types of the class properties
- Specified by:
- getPropertyTypes in interface EntityPersister
- getPropertyTypes in interface ClassMetadata
public ValueInclusion[] getPropertyUpdateGenerationInclusions()
Which of the properties of this class are database generated values on update?
- Specified by:
- getPropertyUpdateGenerationInclusions in interface EntityPersister
public boolean[] getPropertyUpdateability()
Get the "updateability" of the properties of this class (does the property appear in an SQL UPDATE)
- Specified by:
- getPropertyUpdateability in interface EntityPersister
protected boolean[] getPropertyUpdateability(Object entity,
EntityMode entityMode)Which properties appear in the SQL update? (Initialized, updateable ones!)
public Object getPropertyValue(Object object,
String propertyName,
EntityMode entityMode)
throws HibernateExceptionGet the value of a particular (named) property
- Specified by:
- getPropertyValue in interface EntityPersister
- getPropertyValue in interface ClassMetadata
public Object getPropertyValue(Object object,
int i,
EntityMode entityMode)
throws HibernateExceptionGet the value of a particular property
- Specified by:
- getPropertyValue in interface EntityPersister
public Object[] getPropertyValues(Object object,
EntityMode entityMode)
throws HibernateExceptionExtract the property values from the given entity.
- Specified by:
- getPropertyValues in interface EntityPersister
- getPropertyValues in interface ClassMetadata
- Parameters:
entityMode- The entity-mode of the given entity
- Returns:
- The property values.
- Throws:
HibernateException-
public Object[] getPropertyValuesToInsert(Object object,
Map mergeMap,
SessionImplementor session)
throws HibernateExceptionReturn the values of the mapped properties of the object
- Specified by:
- getPropertyValuesToInsert in interface EntityPersister
- getPropertyValuesToInsert in interface ClassMetadata
public boolean[] getPropertyVersionability()
Get the "versionability" of the properties of this class (is the property optimistic-locked)
- Specified by:
- getPropertyVersionability in interface EntityPersister
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 likeEntityPersister.getPropertySpaces(), except that here we include subclass entity spaces.
- Specified by:
- getQuerySpaces in interface EntityPersister
- 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.
- Specified by:
- getRootEntityName in interface EntityPersister
- 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.
- Specified by:
- getRootTableAlias in interface Lockable
- 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.
- Specified by:
- getRootTableIdentifierColumnNames in interface Lockable
- Returns:
- The root table identifier column names.
public String[] getRootTableKeyColumnNames()
The names of the primary key columns in the root table.
- Specified by:
- getRootTableKeyColumnNames in interface PostInsertIdentityPersister
- Returns:
- The primary key column names.
public String getRootTableName()
Locks are always applied to the "root table".
- Specified by:
- getRootTableName in interface Lockable
- Returns:
- The root table name
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)
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).
- Specified by:
- getSelectByUniqueKeyString in interface PostInsertIdentityPersister
- 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
protected String getSequentialSelect(String entityName)
protected String[] getSubclassColumnAliasClosure()
protected String[] getSubclassColumnClosure()
protected boolean[] getSubclassColumnLazyiness()
protected abstract int[] getSubclassColumnTableNumberClosure()
public EntityPersister getSubclassEntityPersister(Object instance, SessionFactoryImplementor factory, EntityMode entityMode)
Get the persister for an instance of this class or a subclass
- Specified by:
- getSubclassEntityPersister in interface EntityPersister
protected String[] getSubclassFormulaAliasClosure()
protected String[] getSubclassFormulaClosure()
protected boolean[] getSubclassFormulaLazyiness()
protected abstract int[] getSubclassFormulaTableNumberClosure()
protected String[] getSubclassFormulaTemplateClosure()
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).
- Specified by:
- getSubclassPropertyColumnAliases in interface SQLLoadable
protected String[][] getSubclassPropertyColumnNameClosure()
public String[] getSubclassPropertyColumnNames(String propertyName)
Return the column names used to persist/query the named property of the class or a subclass (optional operation).
- Specified by:
- getSubclassPropertyColumnNames in interface SQLLoadable
public String[] getSubclassPropertyColumnNames(int i)
- Specified by:
- getSubclassPropertyColumnNames in interface OuterJoinLoadable
public 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.Queryable.getSubclassPropertyTableNumber(String)
- Specified by:
- getSubclassPropertyDeclarer in interface Queryable
- Parameters:
propertyPath- The property name.
- Returns:
- The property declarer
protected String[][] getSubclassPropertyFormulaTemplateClosure()
public String getSubclassPropertyName(int i)
- Specified by:
- getSubclassPropertyName in interface OuterJoinLoadable
protected String[] getSubclassPropertyNameClosure()
protected String[] getSubclassPropertySubclassNameClosure()
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.
- Specified by:
- getSubclassPropertyTableNumber in interface Queryable
protected abstract int getSubclassPropertyTableNumber(int i)
public Type getSubclassPropertyType(int i)
- Specified by:
- getSubclassPropertyType in interface OuterJoinLoadable
protected abstract String[] getSubclassTableKeyColumns(int j)
public abstract String getSubclassTableName(int j)
Get the name of the table with the given index from the internal array.
- Specified by:
- getSubclassTableName in interface Queryable
- Parameters:
- Returns:
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.
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.
- Specified by:
- getTemporaryIdTableDDL in interface Queryable
- 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.
- Specified by:
- getTemporaryIdTableName in interface Queryable
- Returns:
- The appropriate temporary table name.
public Type getType()
Get the type
- Specified by:
- getType in interface PropertyMapping
- getType in interface SQLLoadable
public Object getVersion(Object object,
EntityMode entityMode)
throws HibernateExceptionGet the version number (or timestamp) from the object's version property (or return null if not versioned)
- Specified by:
- getVersion in interface EntityPersister
- getVersion in interface ClassMetadata
public String getVersionColumnName()
For versioned entities, get the name of the column (again, expected on the root table) used to store the version values.
- Specified by:
- getVersionColumnName in interface Lockable
- Returns:
- The version column name.
public Comparator getVersionComparator()
- Specified by:
- getVersionComparator in interface OptimisticCacheSource
public int getVersionProperty()
Get the index of the version property
- Specified by:
- getVersionProperty in interface EntityPersister
- getVersionProperty in interface ClassMetadata
protected String getVersionSelectString()
public VersionType getVersionType()
IfEntityPersister.isVersioned(), then what is the type of the property holding the locking value.
- Specified by:
- getVersionType in interface EntityPersister
- Returns:
- The type of the version property; or null, if not versioned.
protected String getVersionedTableName()
public EntityMode guessEntityMode(Object object)
Try to discover the entity mode from the entity instance
- Specified by:
- guessEntityMode in interface EntityPersister
public boolean hasCache()
Does this class have a cache.
- Specified by:
- hasCache in interface EntityPersister
public boolean hasCascades()
Determine whether this entity has any non-none cascading.
- Specified by:
- hasCascades in interface EntityPersister
- Returns:
- True if the entity has any properties with a cscade other than NONE; false otherwise (aka, no cascading).
public boolean hasCollections()
Determine whether this entity contains references to persistent collections.
- Specified by:
- hasCollections in interface EntityPersister
- Returns:
- True if the entity does contain persistent collections; false otherwise.
protected boolean hasEmbeddedCompositeIdentifier()
protected boolean hasFormulaProperties()
public boolean hasIdentifierProperty()
Does this class have an identifier property?
- Specified by:
- hasIdentifierProperty in interface EntityPersister
- hasIdentifierProperty in interface ClassMetadata
public boolean hasInsertGeneratedProperties()
Does this entity define any properties as being database generated on insert?
- Specified by:
- hasInsertGeneratedProperties in interface EntityPersister
- 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).
- Specified by:
- hasLazyProperties in interface EntityPersister
- 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.
- Specified by:
- hasMutableProperties in interface EntityPersister
- Returns:
- True if any properties of the entity are mutable; false otherwise (meaning none are).
public boolean hasNaturalIdentifier()
Does this entity declare a natural id?
- Specified by:
- hasNaturalIdentifier in interface EntityPersister
- hasNaturalIdentifier in interface ClassMetadata
public boolean hasProxy()
Does this class support dynamic proxies?
- Specified by:
- hasProxy in interface EntityPersister
- hasProxy in interface ClassMetadata
public boolean hasSequentialSelect()
public boolean hasSubclasses()
Does this entity have mapped subclasses?
- Specified by:
- hasSubclasses in interface Loadable
- hasSubclasses in interface ClassMetadata
public boolean hasSubselectLoadableCollections()
Determine whether this entity contains references to persistent collections which are fetchable by subselect?
- Specified by:
- hasSubselectLoadableCollections in interface EntityPersister
- 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?
- Specified by:
- hasUninitializedLazyProperties in interface EntityPersister
public boolean hasUpdateGeneratedProperties()
Does this entity define any properties as being database generated on update?
- Specified by:
- hasUpdateGeneratedProperties in interface EntityPersister
- Returns:
- True if this entity contains at least one property defined as generated (including version property, but not identifier).
protected boolean hasWhere()
public Object[] hydrate(ResultSet rs,
Serializable id,
Object object,
Loadable rootLoadable,
String[][] suffixedPropertyColumns,
boolean allProperties,
SessionImplementor session)
throws SQLException,
HibernateExceptionUnmarshall 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.
- Specified by:
- identifierSelectFragment in interface Queryable
public boolean implementsLifecycle(EntityMode entityMode)
Does the class implement the Lifecycle interface?
- Specified by:
- implementsLifecycle in interface EntityPersister
- implementsLifecycle in interface ClassMetadata
public boolean implementsValidatable(EntityMode entityMode)
Does the class implement the Validatable interface?
- Specified by:
- implementsValidatable in interface EntityPersister
- implementsValidatable in interface ClassMetadata
protected void initLockers()
protected void initSubclassPropertyAliasesMap(PersistentClass model) throws MappingException
Must be called by subclasses, at the end of their constructors
public Object initializeLazyProperty(String fieldName,
Object entity,
SessionImplementor session)
throws HibernateExceptionInitialize the property, and return its new value
- Specified by:
- initializeLazyProperty in interface LazyPropertyInitializer
public Serializable insert(Object[] fields,
Object object,
SessionImplementor session)
throws HibernateExceptionPersist an instance, using a natively generated identifier (optional operation)
- Specified by:
- insert in interface EntityPersister
protected Serializable insert(Object[] fields,
boolean[] notNull,
String sql,
Object object,
SessionImplementor session)
throws HibernateExceptionPerform an SQL INSERT, and then retrieve a generated identifier. This form is used for PostInsertIdentifierGenerator-style ids (IDENTITY, select, etc).
public void insert(Serializable id,
Object[] fields,
Object object,
SessionImplementor session)
throws HibernateExceptionPersist an instance
- Specified by:
- insert in interface EntityPersister
protected void insert(Serializable id,
Object[] fields,
boolean[] notNull,
int j,
String sql,
Object object,
SessionImplementor session)
throws HibernateExceptionPerform 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.
public Object instantiate(Serializable id,
EntityMode entityMode)
throws HibernateExceptionCreate a class instance initialized with the given identifier
- Specified by:
- instantiate in interface EntityPersister
- instantiate in interface ClassMetadata
public boolean isAbstract()
Is this an abstract class?
- Specified by:
- isAbstract in interface Loadable
- isAbstract in interface Queryable
public boolean isBatchLoadable()
Is batch loading enabled?
- Specified by:
- isBatchLoadable in interface EntityPersister
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.
- Specified by:
- isCacheInvalidationRequired in interface EntityPersister
protected abstract boolean isClassOrSuperclassTable(int j)
public boolean isCollection()
Is this instance actually a CollectionPersister?
- Specified by:
- isCollection in interface Joinable
public boolean isDefinedOnSubclass(int i)
- Specified by:
- isDefinedOnSubclass in interface OuterJoinLoadable
protected boolean isDeleteCallable(int j)
public boolean isExplicitPolymorphism()
Is this class explicit polymorphism only?
- Specified by:
- isExplicitPolymorphism in interface Queryable
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.
- Specified by:
- isIdentifierAssignedByInsert in interface EntityPersister
- Returns:
- True if identifiers for this entity are generated by the insert execution.
public boolean isInherited()
Does this entity extend a mapped superclass?
- Specified by:
- isInherited in interface EntityPersister
- isInherited in interface ClassMetadata
protected boolean isInsertCallable(int j)
public boolean isInstance(Object object,
EntityMode entityMode)Is the given object an instance of this entity?
- Specified by:
- isInstance in interface EntityPersister
public boolean isInstrumented(EntityMode entityMode)
Has the class actually been bytecode instrumented?
- Specified by:
- isInstrumented in interface EntityPersister
protected boolean isInverseSubclassTable(int j)
protected boolean isInverseTable(int j)
public boolean isLazyPropertiesCacheable()
Should lazy properties of this entity be cached?
- Specified by:
- isLazyPropertiesCacheable in interface EntityPersister
public boolean isMultiTable()
Is the inheritence hierarchy described by this persister contained across multiple tables?
- Specified by:
- isMultiTable in interface Queryable
- Returns:
- True if the inheritence hierarchy is spread across multiple tables; false otherwise.
public boolean isMutable()
Are instances of this class mutable?
- Specified by:
- isMutable in interface EntityPersister
- isMutable in interface ClassMetadata
protected boolean isNullableSubclassTable(int j)
protected boolean isNullableTable(int j)
public boolean isPolymorphic()
protected abstract boolean isPropertyOfTable(int property,
int j)public boolean isSelectBeforeUpdateRequired()
Is select snapshot before update enabled?
- Specified by:
- isSelectBeforeUpdateRequired in interface EntityPersister
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.
- Specified by:
- isSubclassEntityName in interface EntityPersister
- 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.
protected boolean isSubclassPropertyDeferred(String propertyName,
String entityName)public boolean isSubclassPropertyNullable(int i)
- Specified by:
- isSubclassPropertyNullable in interface OuterJoinLoadable
protected boolean isSubclassTableLazy(int j)
protected boolean isSubclassTableSequentialSelect(int j)
protected abstract boolean isTableCascadeDeleteEnabled(int j)
public Boolean isTransient(Object entity,
SessionImplementor session)
throws HibernateExceptionIs this a new transient instance?
- Specified by:
- isTransient in interface EntityPersister
protected boolean isUpdateCallable(int j)
public boolean isVersionPropertyGenerated()
Does this entity contain a version property that is defined to be database generated?
- Specified by:
- isVersionPropertyGenerated in interface EntityPersister
- 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?
- Specified by:
- isVersionPropertyInsertable in interface Queryable
public boolean isVersioned()
Are instances of this class versioned by a timestamp or version number column?
- Specified by:
- isVersioned in interface EntityPersister
- isVersioned in interface OptimisticCacheSource
- isVersioned in interface ClassMetadata
public Object load(Serializable id,
Object optionalObject,
LockMode lockMode,
SessionImplementor session)
throws HibernateExceptionLoad an instance using either the forUpdateLoader or the outer joining loader, depending upon the value of the lock parameter
- Specified by:
- load in interface EntityPersister
public Object loadByUniqueKey(String propertyName,
Object uniqueKey,
SessionImplementor session)
throws HibernateExceptionLoad an instance of the persistent class, by a unique key other than the primary key.
- Specified by:
- loadByUniqueKey in interface UniqueKeyLoadable
public void lock(Serializable id,
Object version,
Object object,
LockMode lockMode,
SessionImplementor session)
throws HibernateExceptionDo a version check (optional operation)
- Specified by:
- lock in interface EntityPersister
protected void logStaticSQL()
public String oneToManyFilterFragment(String alias)
throws MappingException
- Specified by:
- oneToManyFilterFragment in interface Joinable
protected final int optimisticLockMode()
public void postInstantiate()
throws MappingExceptionFinish the initialization of this object. Called only once perSessionFactorylifecycle, after all entity persisters have been instantiated.
- Specified by:
- postInstantiate in interface EntityPersister
- Throws:
MappingException- Indicates an issue in the metdata.
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 thePersistenceContext. 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.
- Specified by:
- processInsertGeneratedProperties in interface EntityPersister
- Parameters:
id- The entity's id value.entity- The entity for which to get the state.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 thePersistenceContext. 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.
- Specified by:
- processUpdateGeneratedProperties in interface EntityPersister
- Parameters:
id- The entity's id value.entity- The entity for which to get the state.state-session- The session
public String propertySelectFragment(String name,
String suffix,
boolean allProperties)Given a query alias and an identifying suffix, render the property select fragment.
- Specified by:
- propertySelectFragment in interface Queryable
protected String renderSelect(int[] tableNumbers,
int[] columnNumbers,
int[] formulaNumbers)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, returning the id
- Specified by:
- resetIdentifier in interface EntityPersister
- Parameters:
currentId- TODOcurrentVersion- TODO
public String selectFragment(String alias,
String suffix)All columns to select, when loading.
- Specified by:
- selectFragment in interface OuterJoinLoadable
- selectFragment in interface SQLLoadable
public final String selectFragment(Joinable rhs, String rhsAlias, String lhsAlias, String entitySuffix, String collectionSuffix, boolean includeCollectionColumns)
All columns to select, when loading.
- Specified by:
- selectFragment in interface Joinable
public void setIdentifier(Object object,
Serializable id,
EntityMode entityMode)
throws HibernateExceptionSet the identifier of an instance (or do nothing if no identifier property)
- Specified by:
- setIdentifier in interface EntityPersister
- setIdentifier in interface ClassMetadata
public void setPropertyValue(Object object,
String propertyName,
Object value,
EntityMode entityMode)
throws HibernateExceptionSet the value of a particular (named) property
- Specified by:
- setPropertyValue in interface ClassMetadata
public void setPropertyValue(Object object,
int i,
Object value,
EntityMode entityMode)
throws HibernateExceptionSet the value of a particular property
- Specified by:
- setPropertyValue in interface EntityPersister
public void setPropertyValues(Object object,
Object[] values,
EntityMode entityMode)
throws HibernateExceptionSet the given values to the mapped properties of the given object
- Specified by:
- setPropertyValues in interface EntityPersister
- setPropertyValues in interface ClassMetadata
public String[] toColumns(String propertyName)
throws QueryExceptionGiven a property path, return the corresponding column name(s).
- Specified by:
- toColumns in interface PropertyMapping
public String[] toColumns(String alias,
String propertyName)
throws QueryExceptionGiven a query alias and a property path, return the qualified column name
- Specified by:
- toColumns in interface PropertyMapping
public String[] toColumns(String name,
int i)
- Specified by:
- toColumns in interface OuterJoinLoadable
public String toString()
public Type toType(String propertyName) throws QueryException
Given a component path expression, get the type of the property
- Specified by:
- toType in interface PropertyMapping
protected boolean update(Serializable id,
Object[] fields,
Object[] oldFields,
Object rowId,
boolean[] includeProperty,
int j,
Object oldVersion,
Object object,
String sql,
SessionImplementor session)
throws HibernateExceptionpublic void update(Serializable id,
Object[] fields,
int[] dirtyFields,
boolean hasDirtyCollection,
Object[] oldFields,
Object oldVersion,
Object object,
Object rowId,
SessionImplementor session)
throws HibernateExceptionUpdate an object
- Specified by:
- update in interface EntityPersister
protected void updateOrInsert(Serializable id,
Object[] fields,
Object[] oldFields,
Object rowId,
boolean[] includeProperty,
int j,
Object oldVersion,
Object object,
String sql,
SessionImplementor session)
throws HibernateExceptionPerform an SQL UPDATE or SQL INSERT
protected boolean useDynamicInsert()
protected boolean useDynamicUpdate()
protected boolean useGetGeneratedKeys()
protected boolean useInsertSelectIdentity()
public String whereJoinFragment(String alias,
boolean innerJoin,
boolean includeSubclasses)Get the where clause part of any joins (optional operation)
- Specified by:
- whereJoinFragment in interface Joinable