|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.hibernate.persister.entity.AbstractEntityPersister
Basic functionality for persisting an entity via JDBC through either generated or custom SQL
| Nested Class Summary | |
protected static interface |
AbstractEntityPersister.InclusionChecker
|
| Nested classes inherited from class org.hibernate.persister.entity.Queryable |
Queryable.Declarer |
| Field Summary | |
protected String[] |
customSQLDelete
|
protected String[] |
customSQLInsert
|
protected String[] |
customSQLUpdate
|
protected boolean[] |
deleteCallable
|
protected ExecuteUpdateResultCheckStyle[] |
deleteResultCheckStyles
|
static String |
ENTITY_CLASS
|
protected boolean[] |
insertCallable
|
protected ExecuteUpdateResultCheckStyle[] |
insertResultCheckStyles
|
protected BasicEntityPropertyMapping |
propertyMapping
|
protected String |
rowIdName
|
protected boolean[] |
updateCallable
|
protected ExecuteUpdateResultCheckStyle[] |
updateResultCheckStyles
|
| 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(PersistentClass persistentClass,
CacheConcurrencyStrategy cache,
SessionFactoryImplementor factory)
|
|
| Method Summary | |
protected void |
addDiscriminatorToInsert(Insert insert)
|
protected void |
addDiscriminatorToSelect(SelectFragment select,
String name,
String suffix)
|
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 detahced instances of this entity carry their own identifier value. |
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)
|
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 UniqueEntityLoader |
createEntityLoader(LockMode lockMode)
|
protected UniqueEntityLoader |
createEntityLoader(LockMode lockMode,
Map enabledFilters)
|
protected String |
createFrom(int tableNumber,
String alias)
|
protected JoinFragment |
createJoin(int[] tableNumbers,
String drivingAlias)
|
protected JoinFragment |
createJoin(String name,
boolean innerJoin,
boolean includeSubclasses)
|
Object |
createProxy(Serializable id,
SessionImplementor session)
Create a new proxy instance |
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 |
void |
delete(Serializable id,
Object version,
Object object,
SessionImplementor session)
Delete an object |
protected abstract String |
filterFragment(String alias)
|
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) |
protected String |
generateDeleteString(int j)
Generate the SQL that deletes a row by id (and version) |
String |
generateFilterConditionAlias(String rootAlias)
The alias used for any filter conditions (mapped where-fragments or enabled-filters). |
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. |
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) |
CacheConcurrencyStrategy |
getCache()
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 |
protected String |
getDiscriminatorAlias()
|
String |
getDiscriminatorAlias(String suffix)
Get the result set aliases used for the identifier columns, given a suffix |
String |
getDiscriminatorColumnName()
|
protected String |
getDiscriminatorFormulaTemplate()
|
EntityMetamodel |
getEntityMetamodel()
Retrieve the underlying entity metamodel instance... |
String |
getEntityName()
The name of the entity |
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) |
protected String[] |
getIdentifierAliases()
|
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 |
protected int |
getIdentifierColumnSpan()
|
IdentifierGenerator |
getIdentifierGenerator()
Determine which identifier generation strategy is used for this entity. |
String |
getIdentifierPropertyName()
Get the name of the identifier property (or return null) |
Type |
getIdentifierType()
Get the identifier Hibernate type |
String |
getIdentitySelectString()
Get the database-specific SQL command to retrieve the last generated IDENTITY value. |
String[] |
getKeyColumnNames()
The columns to join on |
protected abstract String[] |
getKeyColumns(int j)
|
protected Set |
getLazyProperties()
|
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()
Which properties hold the natural id? |
Object[] |
getNaturalIdentifierSnapshot(Serializable id,
SessionImplementor session)
Retrieve the current state of the natural-id properties from the database. |
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 boolean[] |
getPropertiesToUpdate(int[] dirtyProperties,
boolean hasDirtyCollection)
Transform the array of property indexes to an array of booleans, true when the property is dirty |
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 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) |
String[] |
getPropertyColumnNames(int i)
Get the result set column names mapped for this property (properties of this class, only). |
String[] |
getPropertyColumnNames(String propertyName)
Get the column names for the given property path |
protected int |
getPropertyColumnSpan(int i)
|
int |
getPropertyIndex(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) |
ValueInclusion[] |
getPropertyInsertGenerationInclusions()
Which of the properties of this class are database generated values on insert? |
boolean[] |
getPropertyLaziness()
Get the "laziness" of the properties of this class |
String[] |
getPropertyNames()
Get the names of the class' persistent properties |
boolean[] |
getPropertyNullability()
Get the nullability of the class' persistent properties |
protected int |
getPropertySpan()
|
protected String[] |
getPropertySubclassNames()
|
protected abstract int[] |
getPropertyTableNumbers()
|
protected abstract int[] |
getPropertyTableNumbersInSelect()
|
Type |
getPropertyType(String propertyName)
Get the type of a particular (named) property |
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(Object entity,
EntityMode entityMode)
Which properties appear in the SQL update? (Initialized, updateable ones!) |
ValueInclusion[] |
getPropertyUpdateGenerationInclusions()
Which of the properties of this class are database generated values on 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 (named) property |
Object[] |
getPropertyValues(Object object,
EntityMode entityMode)
Extract the property values from the given entity. |
Object[] |
getPropertyValuesToInsert(Object object,
Map mergeMap,
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) |
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[] |
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). |
protected String |
getSequentialSelect(String entityName)
|
protected String[] |
getSQLDeleteStrings()
|
protected String |
getSQLIdentityInsertString()
The query that inserts a row, letting the database generate an id |
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[] |
getSubclassColumnAliasClosure()
|
protected String[] |
getSubclassColumnClosure()
|
protected boolean[] |
getSubclassColumnLazyiness()
|
protected abstract int[] |
getSubclassColumnTableNumberClosure()
|
EntityPersister |
getSubclassEntityPersister(Object instance,
SessionFactoryImplementor factory,
EntityMode entityMode)
Get the persister for an instance of this class or a subclass |
protected String[] |
getSubclassFormulaAliasClosure()
|
protected String[] |
getSubclassFormulaClosure()
|
protected boolean[] |
getSubclassFormulaLazyiness()
|
protected abstract int[] |
getSubclassFormulaTableNumberClosure()
|
protected String[] |
getSubclassFormulaTemplateClosure()
|
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). |
protected String[][] |
getSubclassPropertyColumnNameClosure()
|
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). |
Queryable.Declarer |
getSubclassPropertyDeclarer(String propertyPath)
Determine whether the given property is declared by our mapped class, our super class, or one of our subclasses... |
protected String[][] |
getSubclassPropertyFormulaTemplateClosure()
|
String |
getSubclassPropertyName(int i)
Get the name of the numbered property of the class or a subclass. |
protected String[] |
getSubclassPropertyNameClosure()
|
protected String[] |
getSubclassPropertySubclassNameClosure()
|
protected abstract int |
getSubclassPropertyTableNumber(int i)
|
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. |
protected Type[] |
getSubclassPropertyTypeClosure()
|
protected abstract String[] |
getSubclassTableKeyColumns(int j)
|
abstract String |
getSubclassTableName(int j)
Get the name of the table with the given index from the internal array. |
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. |
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. |
protected EntityTuplizer |
getTuplizer(EntityMode entityMode)
|
protected EntityTuplizer |
getTuplizer(SessionImplementor session)
|
Type |
getType()
Get the type |
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 together. |
protected String |
getVersionedTableName()
|
int |
getVersionProperty()
Get the index of the version property |
protected String |
getVersionSelectString()
|
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. |
protected boolean |
hasEmbeddedCompositeIdentifier()
|
protected boolean |
hasFormulaProperties()
|
boolean |
hasIdentifierProperty()
Does this class have an identifier property? |
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()
Does this entity declare a natural id? |
boolean |
hasProxy()
Does this class support 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? |
protected boolean |
hasWhere()
|
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 |
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 Serializable |
insert(Object[] fields,
boolean[] notNull,
String sql,
Object object,
SessionImplementor session)
Perform an SQL INSERT, and then retrieve a generated identifier. |