Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.hibernate.persister.entity
Class AbstractEntityPersister  view AbstractEntityPersister download AbstractEntityPersister.java

java.lang.Object
  extended byorg.hibernate.persister.entity.AbstractEntityPersister
All Implemented Interfaces:
org.hibernate.metadata.ClassMetadata, EntityPersister, Joinable, org.hibernate.intercept.LazyPropertyInitializer, Loadable, Lockable, org.hibernate.cache.OptimisticCacheSource, OuterJoinLoadable, org.hibernate.id.PostInsertIdentityPersister, PropertyMapping, Queryable, SQLLoadable, UniqueKeyLoadable
Direct Known Subclasses:
JoinedSubclassEntityPersister, SingleTableEntityPersister, UnionSubclassEntityPersister

public abstract class AbstractEntityPersister
extends java.lang.Object
implements OuterJoinLoadable, Queryable, org.hibernate.metadata.ClassMetadata, UniqueKeyLoadable, SQLLoadable, org.hibernate.intercept.LazyPropertyInitializer, org.hibernate.id.PostInsertIdentityPersister, Lockable

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


Field Summary
private  int batchSize
           
private  org.hibernate.cache.CacheConcurrencyStrategy cache
           
private  org.hibernate.cache.entry.CacheEntryStructure cacheEntryStructure
           
protected  java.lang.String[] customSQLDelete
           
protected  java.lang.String[] customSQLInsert
           
protected  java.lang.String[] customSQLUpdate
           
protected  boolean[] deleteCallable
           
private static java.lang.String DISCRIMINATOR_ALIAS
           
static java.lang.String ENTITY_CLASS
           
private  org.hibernate.tuple.EntityMetamodel entityMetamodel
           
private  java.util.Map entityNameBySubclass
           
private  org.hibernate.engine.SessionFactoryImplementor factory
           
private  org.hibernate.util.FilterHelper filterHelper
           
private  boolean hasFormulaProperties
           
private  boolean hasSubselectLoadableCollections
           
private  java.lang.String[] identifierAliases
           
private  int identifierColumnSpan
           
private  org.hibernate.id.insert.InsertGeneratedIdentifierDelegate identityDelegate
           
protected  boolean[] insertCallable
           
private  boolean isLazyPropertiesCacheable
           
private  java.util.Set lazyProperties
           
private  java.lang.String[][] lazyPropertyColumnAliases
           
private  java.lang.String[] lazyPropertyNames
           
private  int[] lazyPropertyNumbers
           
private  org.hibernate.type.Type[] lazyPropertyTypes
           
private  java.lang.String loaderName
           
private  java.util.Map loaders
           
private  java.util.Map lockers
           
private static org.apache.commons.logging.Log log
           
private  java.lang.String[][] propertyColumnAliases
           
private  java.lang.String[][] propertyColumnFormulaTemplates
           
private  boolean[][] propertyColumnInsertable
           
private  java.lang.String[][] propertyColumnNames
           
private  int[] propertyColumnSpans
           
private  boolean[][] propertyColumnUpdateable
           
private  boolean[] propertyDefinedOnSubclass
           
protected  BasicEntityPropertyMapping propertyMapping
           
private  boolean[] propertySelectable
           
private  java.lang.String[] propertySubclassNames
           
private  boolean[] propertyUniqueness
           
private  org.hibernate.loader.entity.UniqueEntityLoader queryLoader
           
private  java.lang.String[] rootTableKeyColumnNames
           
protected  java.lang.String rowIdName
           
private  java.lang.String[] sqlDeleteStrings
           
private  java.lang.String sqlIdentityInsertString
           
private  java.lang.String sqlInsertGeneratedValuesSelectString
           
private  java.lang.String[] sqlInsertStrings
           
private  java.lang.String sqlLazySelectString
           
private  java.lang.String sqlLazyUpdateByRowIdString
           
private  java.lang.String[] sqlLazyUpdateStrings
           
private  java.lang.String sqlSnapshotSelectString
           
private  java.lang.String sqlUpdateByRowIdString
           
private  java.lang.String sqlUpdateGeneratedValuesSelectString
           
private  java.lang.String[] sqlUpdateStrings
           
private  java.lang.String sqlVersionSelectString
           
private  java.lang.String sqlWhereString
           
private  java.lang.String sqlWhereStringTemplate
           
private  java.lang.String[] subclassColumnAliasClosure
           
private  java.lang.String[] subclassColumnClosure
           
private  boolean[] subclassColumnLazyClosure
           
private  boolean[] subclassColumnSelectableClosure
           
private  java.lang.String[] subclassFormulaAliasClosure
           
private  java.lang.String[] subclassFormulaClosure
           
private  boolean[] subclassFormulaLazyClosure
           
private  java.lang.String[] subclassFormulaTemplateClosure
           
private  java.util.Map subclassPropertyAliases
           
private  org.hibernate.engine.CascadeStyle[] subclassPropertyCascadeStyleClosure
           
private  java.lang.String[][] subclassPropertyColumnNameClosure
           
private  java.util.Map subclassPropertyColumnNames
           
private  int[][] subclassPropertyColumnNumberClosure
           
private  org.hibernate.FetchMode[] subclassPropertyFetchModeClosure
           
private  int[][] subclassPropertyFormulaNumberClosure
           
private  java.lang.String[][] subclassPropertyFormulaTemplateClosure
           
private  java.lang.String[] subclassPropertyNameClosure
           
private  boolean[] subclassPropertyNullabilityClosure
           
private  java.lang.String[] subclassPropertySubclassNameClosure
           
private  org.hibernate.type.Type[] subclassPropertyTypeClosure
           
private  boolean[] tableHasColumns
           
private  java.lang.String temporaryIdTableDDL
           
private  java.lang.String temporaryIdTableName
           
private  java.util.Map uniqueKeyLoaders
           
protected  boolean[] updateCallable
           
private  java.lang.String versionColumnName
           
 
Fields inherited from interface org.hibernate.persister.entity.Loadable
ROWID_ALIAS
 
Fields inherited from interface org.hibernate.persister.entity.EntityPersister
ENTITY_ID
 
Fields inherited from interface org.hibernate.intercept.LazyPropertyInitializer
UNFETCHED_PROPERTY
 
Constructor Summary
AbstractEntityPersister(org.hibernate.mapping.PersistentClass persistentClass, org.hibernate.cache.CacheConcurrencyStrategy cache, org.hibernate.engine.SessionFactoryImplementor factory)
           
 
Method Summary
protected  void addDiscriminatorToInsert(org.hibernate.sql.Insert insert)
           
protected  void addDiscriminatorToSelect(org.hibernate.sql.SelectFragment select, java.lang.String name, java.lang.String suffix)
           
 void afterInitialize(java.lang.Object entity, boolean lazyPropertiesAreUnfetched, org.hibernate.engine.SessionImplementor session)
          Called just after the entities properties have been initialized
 void afterReassociate(java.lang.Object entity, org.hibernate.engine.SessionImplementor session)
          Called just after the entity has been reassociated with the session
 boolean canExtractIdOutOfEntity()
          Do detached instances of this class carry their own identifier value?
protected  boolean check(int rows, java.io.Serializable id, int tableNumber)
           
private  boolean checkVersion(boolean[] includeProperty)
           
protected  java.lang.String concretePropertySelectFragment(java.lang.String alias, boolean[] includeProperty)
           
protected  java.lang.String concretePropertySelectFragmentSansLeadingComma(java.lang.String alias, boolean[] include)
           
 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?
protected  org.hibernate.loader.entity.UniqueEntityLoader createEntityLoader(org.hibernate.LockMode lockMode)
           
protected  org.hibernate.loader.entity.UniqueEntityLoader createEntityLoader(org.hibernate.LockMode lockMode, java.util.Map enabledFilters)
           
protected  java.lang.String createFrom(int tableNumber, java.lang.String alias)
           
protected  org.hibernate.sql.JoinFragment createJoin(int[] tableNumbers, java.lang.String drivingAlias)
           
protected  org.hibernate.sql.JoinFragment createJoin(java.lang.String name, boolean innerJoin, boolean includeSubclasses)
           
private  void createLoaders()
           
 java.lang.Object createProxy(java.io.Serializable id, org.hibernate.engine.SessionImplementor session)
          Create a new proxy instance
protected  void createQueryLoader()
           
protected  org.hibernate.sql.SelectFragment createSelect(int[] subclassColumnNumbers, int[] subclassFormulaNumbers)
           
private  org.hibernate.loader.entity.EntityLoader createUniqueKeyLoader(org.hibernate.type.Type uniqueKeyType, java.lang.String[] columns, java.util.Map enabledFilters)
           
protected  void createUniqueKeyLoaders()
           
protected  java.lang.String createWhereByKey(int tableNumber, java.lang.String alias)
           
protected  int dehydrate(java.io.Serializable id, java.lang.Object[] fields, boolean[] includeProperty, boolean[][] includeColumns, int j, java.sql.PreparedStatement st, org.hibernate.engine.SessionImplementor session)
           
protected  int dehydrate(java.io.Serializable id, java.lang.Object[] fields, java.lang.Object rowId, boolean[] includeProperty, boolean[][] includeColumns, int j, java.sql.PreparedStatement ps, org.hibernate.engine.SessionImplementor session, int index)
          Marshall the fields of a persistent instance to a prepared statement
protected  void delete(java.io.Serializable id, java.lang.Object version, int j, java.lang.Object object, java.lang.String sql, org.hibernate.engine.SessionImplementor session)
          Perform an SQL DELETE
 void delete(java.io.Serializable id, java.lang.Object version, java.lang.Object object, org.hibernate.engine.SessionImplementor session)
          Delete an object
protected abstract  java.lang.String filterFragment(java.lang.String alias)
           
 java.lang.String filterFragment(java.lang.String alias, java.util.Map enabledFilters)
          Get the where clause filter, given a query alias and considering enabled session filters
 int[] findDirty(java.lang.Object[] currentState, java.lang.Object[] previousState, java.lang.Object entity, org.hibernate.engine.SessionImplementor session)
          Locate the property-indices of all properties considered to be dirty.
 int[] findModified(java.lang.Object[] old, java.lang.Object[] current, java.lang.Object entity, org.hibernate.engine.SessionImplementor session)
          Locate the property-indices of all properties considered to be dirty.
 java.lang.Object forceVersionIncrement(java.io.Serializable id, java.lang.Object currentVersion, org.hibernate.engine.SessionImplementor session)
           
 java.lang.String fromJoinFragment(java.lang.String alias, boolean innerJoin, boolean includeSubclasses)
          Get the from clause part of any joins (optional operation)
protected  java.lang.String generateDeleteString(int j)
          Generate the SQL that deletes a row by id (and version)
 java.lang.String generateFilterConditionAlias(java.lang.String rootAlias)
          The alias used for any filter conditions (mapped where-fragments or enabled-filters).
private  java.lang.String generateGeneratedValuesSelectString(boolean[] inclusions)
           
protected  java.lang.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.
protected  java.lang.String generateInsertGeneratedValuesSelectString()
           
protected  java.lang.String generateInsertString(boolean[] includeProperty, int j)
           
protected  java.lang.String generateInsertString(boolean identityInsert, boolean[] includeProperty)
           
protected  java.lang.String generateInsertString(boolean identityInsert, boolean[] includeProperty, int j)
          Generate the SQL that inserts a row
protected  java.lang.String generateLazySelectString()
           
protected  org.hibernate.dialect.lock.LockingStrategy generateLocker(org.hibernate.LockMode lockMode)
           
protected  java.lang.String generateSelectVersionString()
          Generate the SQL that selects the version number by id
protected  java.lang.String generateSnapshotSelectString()
           
protected  java.lang.String generateTableAlias(java.lang.String rootAlias, int tableNumber)
           
protected  java.lang.String generateUpdateGeneratedValuesSelectString()
           
protected  java.lang.String generateUpdateString(boolean[] includeProperty, int j, boolean useRowId)
           
protected  java.lang.String generateUpdateString(boolean[] includeProperty, int j, java.lang.Object[] oldFields, boolean useRowId)
          Generate the SQL that updates a row by id (and version)
private  java.lang.String generateVersionIncrementUpdateString()
           
private  org.hibernate.loader.entity.UniqueEntityLoader getAppropriateLoader(org.hibernate.LockMode lockMode, org.hibernate.engine.SessionImplementor session)
           
private  org.hibernate.loader.entity.EntityLoader getAppropriateUniqueKeyLoader(java.lang.String propertyName, java.util.Map enabledFilters)
           
 org.hibernate.cache.CacheConcurrencyStrategy getCache()
          Get the cache (optional operation)
 org.hibernate.cache.entry.CacheEntryStructure getCacheEntryStructure()
          Get the cache structure
 org.hibernate.engine.CascadeStyle getCascadeStyle(int i)
          Get the cascade style of this (subclass closure) property
 org.hibernate.metadata.ClassMetadata getClassMetadata()
          Get the user-visible metadata for the class (optional operation)
 java.lang.Class getConcreteProxyClass(org.hibernate.EntityMode entityMode)
          Get the proxy interface that instances of this concrete class will be cast to (optional operation).
 java.lang.Object getCurrentVersion(java.io.Serializable id, org.hibernate.engine.SessionImplementor session)
          Retrieve the version number
 java.lang.Object[] getDatabaseSnapshot(java.io.Serializable id, org.hibernate.engine.SessionImplementor session)
          Get the current database state of the object, in a "hydrated" form, without resolving identifiers
protected  java.lang.String getDiscriminatorAlias()
           
 java.lang.String getDiscriminatorAlias(java.lang.String suffix)
          Get the result set aliases used for the identifier columns, given a suffix
 java.lang.String getDiscriminatorColumnName()
           
protected  java.lang.String getDiscriminatorFormulaTemplate()
           
protected  org.hibernate.tuple.EntityMetamodel getEntityMetamodel()
           
 java.lang.String getEntityName()
          The name of the entity
 org.hibernate.type.EntityType getEntityType()
           
 org.hibernate.engine.SessionFactoryImplementor getFactory()
          Return the SessionFactory to which this persister "belongs".
 org.hibernate.FetchMode getFetchMode(int i)
          May this (subclass closure) property be fetched using an SQL outerjoin?
 java.io.Serializable getIdentifier(java.lang.Object object, org.hibernate.EntityMode entityMode)
          Get the identifier of an instance (throw an exception if no identifier property)
protected  java.lang.String[] getIdentifierAliases()
           
 java.lang.String[] getIdentifierAliases(java.lang.String suffix)
          Get the result set aliases used for the identifier columns, given a suffix
 java.lang.String[] getIdentifierColumnNames()
          Get the names of columns used to persist the identifier
protected  int getIdentifierColumnSpan()
           
 org.hibernate.id.IdentifierGenerator getIdentifierGenerator()
          Return the IdentifierGenerator for the class
 java.lang.String getIdentifierPropertyName()
          Get the name of the identifier property (or return null)
 org.hibernate.type.Type getIdentifierType()
          Get the identifier Hibernate type
 java.lang.String getIdentitySelectString()
          Get the database-specific SQL command to retrieve the last generated IDENTITY value.
 java.lang.String[] getKeyColumnNames()
          The columns to join on
protected abstract  java.lang.String[] getKeyColumns(int j)
           
protected  java.util.Set getLazyProperties()
           
private  org.hibernate.dialect.lock.LockingStrategy getLocker(org.hibernate.LockMode lockMode)
           
 java.lang.Class getMappedClass(org.hibernate.EntityMode entityMode)
          The persistent class, or null
 java.lang.String getMappedSuperclass()
          Get the class that this class is mapped as a subclass of - not necessarily the direct superclass
 java.lang.String getName()
          An identifying name; a class name or collection role name.
 int[] getNaturalIdentifierProperties()
          Which properties hold the natural id?
 java.lang.Object[] getNaturalIdentifierSnapshot(java.io.Serializable id, org.hibernate.engine.SessionImplementor session)
          Retrieve the current state of the natural-id properties from the database.
 boolean[] getNonLazyPropertyUpdateability()
           
protected  boolean[] getPropertiesToInsert(java.lang.Object[] fields)
          Transform the array of property indexes to an array of booleans, true when the property is insertable and non-null
protected  boolean[] getPropertiesToUpdate(int[] dirtyProperties, boolean hasDirtyCollection)
          Transform the array of property indexes to an array of booleans, true when the property is dirty
 java.lang.String[] getPropertyAliases(java.lang.String suffix, int i)
          Get the result set aliases used for the property columns, given a suffix (properties of this class, only).
 org.hibernate.engine.CascadeStyle[] getPropertyCascadeStyles()
          Get the cascade styles of the propertes (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)
 java.lang.String[] getPropertyColumnNames(int i)
          Get the result set column names mapped for this property (properties of this class, only).
 java.lang.String[] getPropertyColumnNames(java.lang.String propertyName)
          Get the column names for the given property path
protected  int getPropertyColumnSpan(int i)
           
 int getPropertyIndex(java.lang.String propertyName)
          Get the property number of the unique key property
 boolean[] getPropertyInsertability()
          Get the "insertability" of the properties of this class (does the property appear in an SQL INSERT)
 boolean[] getPropertyInsertGeneration()
          Which of the properties of this class are database generated values on insert?
 boolean[] getPropertyLaziness()
          Get the "laziness" of the properties of this class
 java.lang.String[] getPropertyNames()
          Get the names of the class' persistent properties
 boolean[] getPropertyNullability()
          Get the nullability of the class' persistent properties
protected  int getPropertySpan()
           
protected  java.lang.String[] getPropertySubclassNames()
           
protected abstract  int[] getPropertyTableNumbers()
           
protected abstract  int[] getPropertyTableNumbersInSelect()
           
 org.hibernate.type.Type getPropertyType(java.lang.String propertyName)
          Get the type of a particular (named) property
 org.hibernate.type.Type[] getPropertyTypes()
          Get the Hibernate types of the class properties
 boolean[] getPropertyUpdateability()
          Get the "updateability" of the properties of this class (does the property appear in an SQL UPDATE)
protected  boolean[] getPropertyUpdateability(java.lang.Object entity, org.hibernate.EntityMode entityMode)
          Which properties appear in the SQL update? (Initialized, updateable ones!)
 boolean[] getPropertyUpdateGeneration()
          Which of the properties of this class are database generated values on update?
 java.lang.Object getPropertyValue(java.lang.Object object, int i, org.hibernate.EntityMode entityMode)
          Get the value of a particular property
 java.lang.Object getPropertyValue(java.lang.Object object, java.lang.String propertyName, org.hibernate.EntityMode entityMode)
          Get the value of a particular (named) property
 java.lang.Object[] getPropertyValues(java.lang.Object object, org.hibernate.EntityMode entityMode)
          Extract the property values from the given entity.
 java.lang.Object[] getPropertyValuesToInsert(java.lang.Object object, java.util.Map mergeMap, org.hibernate.engine.SessionImplementor session)
          Return the values of the mapped properties of the object
 boolean[] getPropertyVersionability()
          Get the "versionability" of the properties of this class (is the property optimistic-locked)
 java.io.Serializable[] getQuerySpaces()
          Returns an array of objects that identify spaces in which properties of this class are persisted, for instances of this class and its subclasses.
private  java.lang.String getRootAlias()
           
 java.lang.String getRootEntityName()
          Returns an object that identifies the space in which identifiers of this class hierarchy are unique.
 java.lang.String[] getRootTableIdentifierColumnNames()
          Get the names of columns on the root table used to persist the identifier.
 java.lang.String[] getRootTableKeyColumnNames()
          The names of the primary key columns in the root table.
 java.lang.String getRootTableName()
          Locks are always applied to the "root table".
 java.lang.String getSelectByUniqueKeyString(java.lang.String propertyName)
          Get a SQL select string that performs a select based on a unique key determined by the given property name).
protected  java.lang.String getSequentialSelect(java.lang.String entityName)
           
protected  java.lang.String[] getSQLDeleteStrings()
           
protected  java.lang.String getSQLIdentityInsertString()
          The query that inserts a row, letting the database generate an id
protected  java.lang.String[] getSQLInsertStrings()
           
protected  java.lang.String getSQLLazySelectString()
           
protected  java.lang.String[] getSQLLazyUpdateByRowIdStrings()
           
protected  java.lang.String[] getSQLLazyUpdateStrings()
           
protected  java.lang.String getSQLSnapshotSelectString()
           
protected  java.lang.String[] getSQLUpdateByRowIdStrings()
           
protected  java.lang.String[] getSQLUpdateStrings()
           
protected  java.lang.String getSQLWhereString(java.lang.String alias)
           
protected  java.lang.String[] getSubclassColumnAliasClosure()
           
protected  java.lang.String[] getSubclassColumnClosure()
           
protected  boolean[] getSubclassColumnLazyiness()
           
protected abstract  int[] getSubclassColumnTableNumberClosure()
           
private  java.lang.String getSubclassEntityName(java.lang.Class clazz)
           
 EntityPersister getSubclassEntityPersister(java.lang.Object instance, org.hibernate.engine.SessionFactoryImplementor factory, org.hibernate.EntityMode entityMode)
          Get the persister for an instance of this class or a subclass
protected  java.lang.String[] getSubclassFormulaAliasClosure()
           
protected  java.lang.String[] getSubclassFormulaClosure()
           
protected  boolean[] getSubclassFormulaLazyiness()
           
protected abstract  int[] getSubclassFormulaTableNumberClosure()
           
protected  java.lang.String[] getSubclassFormulaTemplateClosure()
           
 java.lang.String[] getSubclassPropertyColumnAliases(java.lang.String propertyName, java.lang.String suffix)
          Return the column alias names used to persist/query the named property of the class or a subclass (optional operation).
protected  java.lang.String[][] getSubclassPropertyColumnNameClosure()
           
 java.lang.String[] getSubclassPropertyColumnNames(int i)
          Return the column names used to persist the numbered property of the class or a subclass.
 java.lang.String[] getSubclassPropertyColumnNames(java.lang.String propertyName)