public abstract class AbstractEntityPersister extends Object implements OuterJoinLoadable, Queryable, ClassMetadata, UniqueKeyLoadable, SQLLoadable, LazyPropertyInitializer, PostInsertIdentityPersister, Lockable
Basic functionality for persisting an entity via JDBC through either generated or custom SQL
| Type | Property and Description |
|---|---|
boolean |
hasIdentifier
Determine whether the entity has a particular property holding
the identifier value.
|
| Modifier and Type | Class and Description |
|---|---|
static interface |
AbstractEntityPersister.CacheEntryHelper
Consolidated these onto a single helper because the 2 pieces work in tandem.
|
protected static interface |
AbstractEntityPersister.InclusionChecker |
Queryable.DeclarerLazyPropertyInitializer.InterceptorImplementor| Modifier and Type | Field and Description |
|---|---|
protected int |
batchSize |
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
Warning:
When there are duplicated property names in the subclasses
then propertyMapping will only contain one of those properties.
|
protected String |
rowIdName |
protected boolean[] |
updateCallable |
protected ExecuteUpdateResultCheckStyle[] |
updateResultCheckStyles |
ROWID_ALIASENTITY_IDUNFETCHED_PROPERTY| Constructor and Description |
|---|
AbstractEntityPersister(PersistentClass persistentClass,
EntityDataAccess cacheAccessStrategy,
NaturalIdDataAccess naturalIdRegionAccessStrategy,
PersisterCreationContext creationContext) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addDiscriminatorToInsert(Insert insert) |
protected void |
addDiscriminatorToSelect(SelectFragment select,
String name,
String suffix) |
void |
afterInitialize(Object entity,
SharedSessionContractImplementor session)
Called just after the entities properties have been initialized
|
void |
afterReassociate(Object entity,
SharedSessionContractImplementor session)
Called just after the entity has been reassociated with the session
|
CacheEntry |
buildCacheEntry(Object entity,
Object[] state,
Object version,
SharedSessionContractImplementor session) |
protected AbstractEntityPersister.CacheEntryHelper |
buildCacheEntryHelper() |
boolean |
canExtractIdOutOfEntity()
Determine whether detached instances of this entity carry their own
identifier value.
|
boolean |
canReadFromCache() |
boolean |
canUseReferenceCacheEntries() |
boolean |
canWriteToCache() |
protected boolean |
check(int rows,
Serializable id,
int tableNumber,
Expectation expectation,
PreparedStatement statement) |
protected boolean |
checkVersion(boolean[] includeProperty) |
protected String |
concretePropertySelectFragment(String alias,
AbstractEntityPersister.InclusionChecker inclusionChecker) |
protected String |
concretePropertySelectFragment(String alias,
boolean[] includeProperty) |
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)
Used internally to create static loaders.
|
protected UniqueEntityLoader |
createEntityLoader(LockMode lockMode,
LoadQueryInfluencers loadQueryInfluencers) |
protected UniqueEntityLoader |
createEntityLoader(LockOptions lockOptions,
LoadQueryInfluencers loadQueryInfluencers) |
protected String |
createFrom(int tableNumber,
String alias) |
protected JoinFragment |
createJoin(int[] tableNumbers,
String drivingAlias) |
protected JoinFragment |
createJoin(String name,
boolean innerJoin,
boolean includeSubclasses,
Set<String> treatAsDeclarations) |
protected void |
createLoaders() |
Object |
createProxy(Serializable id,
SharedSessionContractImplementor 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,
SharedSessionContractImplementor session,
boolean isUpdate) |
protected int |
dehydrate(Serializable id,
Object[] fields,
Object rowId,
boolean[] includeProperty,
boolean[][] includeColumns,
int j,
PreparedStatement ps,
SharedSessionContractImplementor session,
int index,
boolean isUpdate)
Marshall the fields of a persistent instance to a prepared statement
|
protected void |
delete(Serializable id,
Object version,
int j,
Object object,
String sql,
SharedSessionContractImplementor session,
Object[] loadedState)
Perform an SQL DELETE
|
void |
delete(Serializable id,
Object version,
Object object,
SharedSessionContractImplementor session)
Delete an object
|
protected JoinType |
determineSubclassTableJoinType(int subclassTableNumber,
boolean canInnerJoin,
boolean includeSubclasses,
Set<String> treatAsDeclarations) |
protected String |
determineTableName(Table table,
JdbcEnvironment jdbcEnvironment) |
int |
determineTableNumberForColumn(String columnName) |
protected void |
doPostInstantiate() |
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
|
String |
filterFragment(String alias,
Map enabledFilters,
Set<String> treatAsDeclarations)
Get the where clause filter, given a query alias and considering enabled session filters
|
protected abstract String |
filterFragment(String alias,
Set<String> treatAsDeclarations) |
int[] |
findDirty(Object[] currentState,
Object[] previousState,
Object entity,
SharedSessionContractImplementor session)
Locate the property-indices of all properties considered to be dirty.
|
int[] |
findModified(Object[] old,
Object[] current,
Object entity,
SharedSessionContractImplementor session)
Locate the property-indices of all properties considered to be dirty.
|
Object |
forceVersionIncrement(Serializable id,
Object currentVersion,
SharedSessionContractImplementor session) |
String |
fromJoinFragment(String alias,
boolean innerJoin,
boolean includeSubclasses)
Get the from clause part of any joins
(optional operation)
|
String |
fromJoinFragment(String alias,
boolean innerJoin,
boolean includeSubclasses,
Set<String> treatAsDeclarations)
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)
|
void |
generateEntityDefinition()
Generate the entity definition for this object.
|
String |
generateFilterConditionAlias(String rootAlias)
The alias used for any filter conditions (mapped where-fragments or
enabled-filters).
|
protected String |
generateIdByUniqueKeySelectString(String uniquePropertyName) |
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 Map<String,String> |
generateLazySelectStringsByFetchGroup() |
protected LockingStrategy |
generateLocker(LockMode lockMode) |
protected String |
generateSelectVersionString()
Generate the SQL that selects the version number by id
|
protected String |
generateSnapshotSelectString() |
static String |
generateTableAlias(String rootAlias,
int tableNumber) |
protected String |
generateUpdateGeneratedValuesSelectString() |
protected String |
generateUpdateString(boolean[] includeProperty,
int j,
boolean useRowId) |
protected String |
generateUpdateString(boolean[] includeProperty,
int j,
Object[] oldFields,
boolean useRowId)
Generate the SQL that updates a row by id (and version)
|
protected UniqueEntityLoader |
getAppropriateLoader(LockOptions lockOptions,
SharedSessionContractImplementor session) |
Iterable<AttributeDefinition> |
getAttributes() |
EntityDataAccess |
getCacheAccessStrategy()
Get the cache (optional operation)
|
CacheEntryStructure |
getCacheEntryStructure()
Get the cache structure
|
CascadeStyle |
getCascadeStyle(int i)
Get the cascade style of this (subclass closure) property
|
ClassMetadata |
getClassMetadata()
Get the user-visible metadata for the class (optional operation)
|
protected Serializable |
getCollectionKey(CollectionPersister persister,
Object owner,
EntityEntry ownerEntry,
SharedSessionContractImplementor session) |
Class |
getConcreteProxyClass()
Get the proxy interface that instances of <em>this</em> concrete class will be
cast to (optional operation).
|
Object |
getCurrentVersion(Serializable id,
SharedSessionContractImplementor session)
Retrieve the version number
|
Object[] |
getDatabaseSnapshot(Serializable id,
SharedSessionContractImplementor 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() |
String |
getDiscriminatorColumnReaders() |
String |
getDiscriminatorColumnReaderTemplate() |
protected String |
getDiscriminatorFormulaTemplate() |
EntityEntryFactory |
getEntityEntryFactory()
Get the EntityEntryFactory indicated for the entity mapped by this persister.
|
EntityIdentifierDefinition |
getEntityKeyDefinition() |
EntityMetamodel |
getEntityMetamodel()
Retrieve the underlying entity metamodel instance…
|
EntityMode |
getEntityMode() |
String |
getEntityName()
The entity name which this persister maps.
|
EntityPersister |
getEntityPersister() |
EntityTuplizer |
getEntityTuplizer() |
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 |
getIdByUniqueKey(Serializable key,
String uniquePropertyName,
SharedSessionContractImplementor session) |
Serializable |
getIdentifier(Object object)
Get the identifier of an instance (throw an exception if no identifier property)
|
Serializable |
getIdentifier(Object entity,
SharedSessionContractImplementor session)
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
|
String[] |
getIdentifierColumnReaders() |
String[] |
getIdentifierColumnReaderTemplates() |
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) - need not return the
name of an actual Java property
|
Type |
getIdentifierType()
Get the identifier type
|
String |
getIdentitySelectString()
Get the database-specific SQL command to retrieve the last
generated IDENTITY value.
|
BytecodeEnhancementMetadata |
getInstrumentationMetadata() |
String[] |
getKeyColumnNames()
The columns to join on
|
protected abstract String[] |
getKeyColumns(int j) |
protected UniqueEntityLoader |
getLoaderByLockMode(LockMode lockMode) |
protected Map |
getLoaders()
Deprecated.
Because there are better patterns for this
|
Class |
getMappedClass()
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.
|
NaturalIdDataAccess |
getNaturalIdCacheAccessStrategy()
Get the NaturalId cache (optional operation)
|
int[] |
getNaturalIdentifierProperties()
If the entity defines a natural id (
EntityPersister.hasNaturalIdentifier()), which
properties make up the natural id. |
Object[] |
getNaturalIdentifierSnapshot(Serializable id,
SharedSessionContractImplementor session)
Retrieve the current state of the natural-id properties from the database.
|
NavigableRole |
getNavigableRole() |
boolean[] |
getNonLazyPropertyUpdateability() |
String[][] |
getPolymorphicJoinColumns(String lhsTableAlias,
String propertyPath) |
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 properties (optional operation)
|
boolean[] |
getPropertyCheckability()
Get the "checkability" of the properties of this class
(is the property dirty checked, does the cache need
to be updated)
|
protected boolean[][] |
getPropertyColumnInsertable() |
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) |
protected boolean[][] |
getPropertyColumnUpdateable() |
String[] |
getPropertyColumnWriters(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()
Deprecated.
no simple, direct replacement
|
boolean[] |
getPropertyLaziness()
Get the "laziness" of the properties of this class
|
String[] |
getPropertyNames()
Get the names of the class properties - doesn’t have to be the names of the
actual Java properties (used for XML generation only)
|
boolean[] |
getPropertyNullability()
Get the nullability of the properties of this class
|
protected boolean[] |
getPropertySelectable() |
protected int |
getPropertySpan() |
protected String[] |
getPropertySubclassNames() |
protected abstract int[] |
getPropertyTableNumbers() |
protected abstract int[] |
getPropertyTableNumbersInSelect() |
Type |
getPropertyType(String propertyName)
Get the type of a particular property by name.
|
Type[] |
getPropertyTypes()
Get the Hibernate types of the class properties
|
boolean[] |
getPropertyUniqueness() |
boolean[] |
getPropertyUpdateability()
Get the "updateability" of the properties of this class
(does the property appear in an SQL UPDATE)
|
protected boolean[] |
getPropertyUpdateability(Object entity)
Which properties appear in the SQL update?
(Initialized, updateable ones!)
|
ValueInclusion[] |
getPropertyUpdateGenerationInclusions()
Deprecated.
no simple, direct replacement
|
Object |
getPropertyValue(Object object,
int i)
Get the value of a particular property
|
Object |
getPropertyValue(Object object,
String propertyName)
Get the value of a particular property
|
Object[] |
getPropertyValues(Object object)
Return the (loaded) values of the mapped properties of the object (not including backrefs)
|
Object[] |
getPropertyValuesToInsert(Object object,
Map mergeMap,
SharedSessionContractImplementor session)
Return the values of the insertable properties of the object (including backrefs)
|
boolean[] |
getPropertyVersionability()
Get the "versionability" of the properties of this class
(is the property optimistic-locked)
|
Serializable[] |
getQuerySpaces()
Returns an array of objects that identify spaces in which properties of
this entity are persisted, for instances of this class and its subclasses.
|
String |
getRootEntityName()
Returns an object that identifies the space in which identifiers of
this entity hierarchy are unique.
|
String |
getRootTableAlias(String drivingAlias)
Get the SQL alias this persister would use for the root table
given the passed driving alias.
|
String[] |
getRootTableIdentifierColumnNames()
Get the names of columns on the root table used to persist the identifier.
|
String[] |
getRootTableKeyColumnNames()
The names of the primary key columns in the root table.
|
String |
getRootTableName()
Locks are always applied to the "root table".
|
String |
getSelectByUniqueKeyString(String propertyName)
Get a SQL select string that performs a select based on a unique
key determined by the given property name).
|
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(String fetchGroup) |
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() |
String[] |
getSubclassColumnReaderTemplateClosure() |
protected abstract int[] |
getSubclassColumnTableNumberClosure() |
EntityPersister |
getSubclassEntityPersister(Object instance,
SessionFactoryImplementor factory)
A request has already identified the entity-name of this persister as the mapping for the given instance.
|
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).
|
String[][] |
getSubclassPropertyColumnReaderClosure() |
String[][] |
getSubclassPropertyColumnReaderTemplateClosure() |
Queryable.Declarer |
getSubclassPropertyDeclarer(String propertyPath)
Determine whether the given property is declared by our
mapped class, our super class, or one of our subclasses…
<p/>
Note: the method is called 'subclass property…' simply
for consistency sake (e.g.
|
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.
|
abstract int |
getSubclassTableSpan() |
String |
getTableAliasForColumn(String columnName,
String rootAlias)
Given a column name and the root table alias in use for the entity hierarchy, determine the proper table alias
for the table in that hierarchy that contains said column.
|
static int |
getTableId(String tableName,
String[] tables) |
protected abstract String |
getTableName(int j) |
protected abstract int |
getTableSpan() |
protected boolean[] |
getTableUpdateNeeded(int[] dirtyProperties,
boolean hasDirtyCollection)
Decide which tables need to be updated.
|
protected static String |
getTemplateFromString(String string,
SessionFactoryImplementor factory) |
Type |
getType()
Get the type of the thing containing the properties
|
DiscriminatorMetadata |
getTypeDiscriminatorMetadata()
Retrieve the information needed to properly deal with this entity’s discriminator
in a query.
|
Object |
getVersion(Object object)
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() |
protected String |
getVersionedTableName() |
int |
getVersionProperty()
If
EntityPersister.isVersioned(), then what is the index of the property
holding the locking value. |
protected String |
getVersionSelectString() |
VersionType |
getVersionType()
If
EntityPersister.isVersioned(), then what is the type of the property
holding the locking value. |
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()
Determine whether the entity has a particular property holding
the identifier value.
|
boolean |
hasInsertGeneratedProperties()
Does this entity define any properties as being database generated on insert?
|
boolean |
hasLazyProperties()
Determine whether this entity defines any lazy properties (ala
bytecode instrumentation).
|
boolean |
hasMutableProperties()
Determine whether any properties of this entity are considered mutable.
|
boolean |
hasNaturalIdCache()
Does this class have a natural id cache
|
boolean |
hasNaturalIdentifier()
Determine whether this entity defines a natural identifier.
|
boolean |
hasProxy()
Determine whether this entity supports dynamic proxies.
|
boolean |
hasRowId()
Does the result set contain rowids?
|
boolean |
hasSequentialSelect() |
boolean |
hasSubclasses()
Does this persistent class have subclasses?
|
boolean |
hasSubselectLoadableCollections()
Determine whether this entity contains references to persistent collections
which are fetchable by subselect?
|
boolean |
hasUninitializedLazyProperties(Object object)
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,
SharedSessionContractImplementor 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 identifier select fragment.
|
boolean |
implementsLifecycle()
Does the class implement the
Lifecycle interface. |
Object |
initializeLazyProperty(String fieldName,
Object entity,
SharedSessionContractImplementor 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,
SharedSessionContractImplementor session)
Perform an SQL INSERT, and then retrieve a generated identifier.
|
Serializable |
insert(Object[] fields,
Object object,
SharedSessionContractImplementor session)
Persist an instance, using a natively generated identifier (optional operation)
|
protected void |
insert(Serializable id,
Object[] fields,
boolean[] notNull,
int j,
String sql,
Object object,
SharedSessionContractImplementor session)
Perform an SQL INSERT.
|
void |
insert(Serializable id,
Object[] fields,
Object object,
SharedSessionContractImplementor session)
Persist an instance
|
Object |
instantiate(Serializable id,
SharedSessionContractImplementor session)
Create a class instance initialized with the given identifier
|
boolean |
isAbstract()
Is this an abstract class?
|
protected boolean |
isAllNull(Object[] array,
int tableNumber) |
boolean |
isBatchable() |
boolean |
isBatchLoadable()
Is batch loading enabled?
|
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.
|
protected abstract boolean |
isClassOrSuperclassTable(int j) |
boolean |
isCollection()
Is this instance actually a CollectionPersister?
|
boolean |
isDefinedOnSubclass(int i)
Is this property defined on a subclass of the mapped class.
|
protected boolean |
isDeleteCallable(int j) |
boolean |
isExplicitPolymorphism()
Is this class explicit polymorphism only?
|
boolean |
isIdentifierAssignedByInsert()
Are identifiers of this entity assigned known before the insert execution?
Or, are they generated (in the database) by the insert execution.
|
boolean |
isInherited()
Determine whether the entity is inherited one or more other entities.
|
protected boolean |
isInsertCallable(int j) |
boolean |
isInstance(Object object)
Is the given object an instance of this entity?
|
boolean |
isInstrumented()
Has the class actually been bytecode instrumented?
|
protected boolean |
isInverseSubclassTable(int j) |
protected boolean |
isInverseTable(int j) |
boolean |
isLazyPropertiesCacheable()
Should lazy properties of this entity be cached?
|
protected boolean |
isModifiableEntity(EntityEntry entry) |
boolean |
isMultiTable()
Is the inheritance hierarchy described by this persister contained across
multiple tables?
|
boolean |
isMutable()
Determine whether instances of this entity are considered mutable.
|
protected boolean |
isNaturalIdNonNullable() |
protected boolean |
isNullableSubclassTable(int j) |
protected boolean |
isNullableTable(int j) |
boolean |
isPolymorphic() |
protected abstract boolean |
isPropertyOfTable(int property,
int j) |
boolean |
isSelectBeforeUpdateRequired()
Is select snapshot before update enabled?
|
boolean |
isSubclassEntityName(String entityName)
Determine whether the given name represents a subclass entity
(or this entity itself) of the entity mapped by this persister.
|
protected boolean |
isSubclassPropertyDeferred(String propertyName,
String entityName) |
boolean |
isSubclassPropertyNullable(int i)
Is the numbered property of the class of subclass nullable?
|
protected boolean |
isSubclassTableIndicatedByTreatAsDeclarations(int subclassTableNumber,
Set<String> treatAsDeclarations) |
protected boolean |
isSubclassTableLazy(int j) |
protected boolean |
isSubclassTableSequentialSelect(int j) |
protected abstract boolean |
isTableCascadeDeleteEnabled(int j) |
Boolean |
isTransient(Object entity,
SharedSessionContractImplementor session)
Is this a new transient instance?
|
protected boolean |
isUpdateCallable(int j) |
boolean |
isVersioned()
Determine whether optimistic locking by column is enabled for this
entity.
|
boolean |
isVersionPropertyGenerated()
Does this entity contain a version property that is defined
to be database generated?
|
boolean |
isVersionPropertyInsertable()
Is the version property included in insert statements?
|
Object |
load(Serializable id,
Object optionalObject,
LockMode lockMode,
SharedSessionContractImplementor session)
Load an instance using either the <tt>forUpdateLoader</tt> or the outer joining <tt>loader</tt>,
depending upon the value of the <tt>lock</tt> parameter
|
Object |
load(Serializable id,
Object optionalObject,
LockOptions lockOptions,
SharedSessionContractImplementor session)
Load an instance using either the <tt>forUpdateLoader</tt> or the outer joining <tt>loader</tt>,
depending upon the value of the <tt>lock</tt> parameter
|
Object |
loadByUniqueKey(String propertyName,
Object uniqueKey,
SharedSessionContractImplementor session)
Load an instance of the persistent class, by a unique key other
than the primary key.
|
Serializable |
loadEntityIdByNaturalId(Object[] naturalIdValues,
LockOptions lockOptions,
SharedSessionContractImplementor session)
Load the id for the entity based on the natural id.
|
void |
lock(Serializable id,
Object version,
Object object,
LockMode lockMode,
SharedSessionContractImplementor session)
Do a version check (optional operation)
|
void |
lock(Serializable id,
Object version,
Object object,
LockOptions lockOptions,
SharedSessionContractImplementor session)
Do a version check (optional operation)
|
protected void |
logStaticSQL() |
List |
multiLoad(Serializable[] ids,
SharedSessionContractImplementor session,
MultiLoadOptions loadOptions)
Performs a load of multiple entities (of this type) by identifier simultaneously.
|
String |
oneToManyFilterFragment(String alias) |
String |
oneToManyFilterFragment(String alias,
Set<String> treatAsDeclarations) |
protected OptimisticLockStyle |
optimisticLockStyle() |
protected void |
postConstruct(Mapping mapping)
Post-construct is a callback for AbstractEntityPersister subclasses to call after they are all done with their
constructor processing.
|
void |
postInstantiate()
Finish the initialization of this object.
|
void |
processInsertGeneratedProperties(Serializable id,
Object entity,
Object[] state,
SharedSessionContractImplementor session)
Perform a select to retrieve the values of any generated properties
back from the database, injecting these generated values into the
given entity as well as writing this state to the
PersistenceContext. |
void |
processUpdateGeneratedProperties(Serializable id,
Object entity,
Object[] state,
SharedSessionContractImplementor session)
Perform a select to retrieve the values of any generated properties
back from the database, injecting these generated values into the
given entity as well as writing this state to the
PersistenceContext. |
String |
propertySelectFragment(String tableAlias,
String suffix,
boolean allProperties)
Given a query alias and an identifying suffix, render the property select fragment.
|
SelectFragment |
propertySelectFragmentFragment(String tableAlias,
String suffix,
boolean allProperties) |
void |
registerAffectingFetchProfile(String fetchProfileName)
Register the name of a fetch profile determined to have an affect on the
underlying loadable in regards to the fact that the underlying load SQL
needs to be adjust when the given fetch profile is enabled.
|
protected String |
renderSelect(int[] tableNumbers,
int[] columnNumbers,
int[] formulaNumbers) |
void |
resetIdentifier(Object entity,
Serializable currentId,
Object currentVersion,
SharedSessionContractImplementor session)
Set the identifier and version of the given instance back to its "unsaved" value.
|
int[] |
resolveAttributeIndexes(String[] attributeNames)
Converts an array of attribute names to a set of indexes, according to the entity metamodel
|
String |
selectFragment(Joinable rhs,
String rhsAlias,
String lhsAlias,
String entitySuffix,
String collectionSuffix,
boolean includeCollectionColumns)
All columns to select, when loading.
|
String |
selectFragment(String alias,
String suffix)
Generate a list of collection index, key and element columns
|
void |
setIdentifier(Object entity,
Serializable id,
SharedSessionContractImplementor session)
Inject the identifier value into the given entity.
|
void |
setPropertyValue(Object object,
int i,
Object value)
Set the value of a particular property
|
void |
setPropertyValue(Object object,
String propertyName,
Object value)
Set the value of a particular (named) property
|
void |
setPropertyValues(Object object,
Object[] values)
Set the given values to the mapped properties of the given object
|
String[] |
toColumns(String propertyName)
Given a property path, return the corresponding column name(s).
|
String[] |
toColumns(String name,
int i)
Given the number of a property of a subclass, and a table alias,
return the aliased column names.
|
String[] |
toColumns(String alias,
String propertyName)
Obtain aliased column/formula fragments for the specified property path.
|
String |
toString() |
Type |
toType(String propertyName)
Given a component path expression, get the type of the property
|
void |
update(Serializable id,
Object[] fields,
int[] dirtyFields,
boolean hasDirtyCollection,
Object[] oldFields,
Object oldVersion,
Object object,
Object rowId,
SharedSessionContractImplementor session)
Update an object
|
protected boolean |
update(Serializable id,
Object[] fields,
Object[] oldFields,
Object rowId,
boolean[] includeProperty,
int j,
Object oldVersion,
Object object,
String sql,
SharedSessionContractImplementor session) |
protected void |
updateOrInsert(Serializable id,
Object[] fields,
Object[] oldFields,
Object rowId,
boolean[] includeProperty,
int j,
Object oldVersion,
Object object,
String sql,
SharedSessionContractImplementor session)
Perform an SQL UPDATE or SQL INSERT
|
protected boolean |
useDynamicInsert() |
protected boolean |
useDynamicUpdate() |
protected boolean |
useGetGeneratedKeys() |
protected boolean |
useInsertSelectIdentity() |
String |
whereJoinFragment(String alias,
boolean innerJoin,
boolean includeSubclasses)
Get the where clause part of any joins
(optional operation)
|
String |
whereJoinFragment(String alias,
boolean innerJoin,
boolean includeSubclasses,
Set<String> treatAsDeclarations)
Get the where clause part of any joins
(optional operation)
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitfromTableFragment, getPropertyTableName, getSubclassPropertyTableNamegetConstraintOrderedTableNameClosure, getContraintOrderedTableKeyColumnClosure, getDiscriminatorSQLValuegetTableNamegetIdentifier, getPropertyValuesToInsert, instantiate, setIdentifiergetDiscriminatorType, getDiscriminatorValue, getSubclassForDiscriminatorValuegetFilterAliasGenerator, getPropertySpacespublic boolean hasIdentifierProperty
hasIdentifierProperty in interface ClassMetadatahasIdentifierProperty in interface EntityPersisterpublic static final String ENTITY_CLASS
protected final int batchSize
protected final String rowIdName
protected boolean[] insertCallable
protected boolean[] updateCallable
protected boolean[] deleteCallable
protected String[] customSQLInsert
protected String[] customSQLUpdate
protected String[] customSQLDelete
protected ExecuteUpdateResultCheckStyle[] insertResultCheckStyles
protected ExecuteUpdateResultCheckStyle[] updateResultCheckStyles
protected ExecuteUpdateResultCheckStyle[] deleteResultCheckStyles
protected final BasicEntityPropertyMapping propertyMapping
Warning: When there are duplicated property names in the subclasses then propertyMapping will only contain one of those properties. To ensure correct results, propertyMapping should only be used for the concrete EntityPersister (since the concrete EntityPersister cannot have duplicated property names).
public AbstractEntityPersister(PersistentClass persistentClass, EntityDataAccess cacheAccessStrategy, NaturalIdDataAccess naturalIdRegionAccessStrategy, PersisterCreationContext creationContext) throws HibernateException
HibernateExceptionprotected void addDiscriminatorToInsert(Insert insert)
protected void addDiscriminatorToSelect(SelectFragment select, String name, String suffix)
protected abstract int[] getSubclassColumnTableNumberClosure()
protected abstract int[] getSubclassFormulaTableNumberClosure()
public abstract String getSubclassTableName(int j)
QueryableGet the name of the table with the given index from the internal array.
getSubclassTableName in interface Queryablej - The index into the internal array.protected abstract String[] getSubclassTableKeyColumns(int j)
protected abstract boolean isClassOrSuperclassTable(int j)
public abstract int getSubclassTableSpan()
protected abstract int getTableSpan()
protected abstract boolean isTableCascadeDeleteEnabled(int j)
protected abstract String getTableName(int j)
protected abstract String[] getKeyColumns(int j)
protected abstract boolean isPropertyOfTable(int property,
int j)
protected abstract int[] getPropertyTableNumbersInSelect()
protected abstract int[] getPropertyTableNumbers()
protected abstract int getSubclassPropertyTableNumber(int i)
protected abstract String filterFragment(String alias) throws MappingException
MappingExceptionprotected abstract String filterFragment(String alias, Set<String> treatAsDeclarations)
public String getDiscriminatorColumnName()
getDiscriminatorColumnName in interface Loadablepublic String getDiscriminatorColumnReaders()
public String getDiscriminatorColumnReaderTemplate()
protected String getDiscriminatorAlias()
protected String getDiscriminatorFormulaTemplate()
protected boolean isInverseTable(int j)
protected boolean isNullableTable(int j)
protected boolean isNullableSubclassTable(int j)
protected boolean isInverseSubclassTable(int j)
public boolean isSubclassEntityName(String entityName)
EntityPersisterDetermine whether the given name represents a subclass entity (or this entity itself) of the entity mapped by this persister.
isSubclassEntityName in interface EntityPersisterentityName - The entity name to be checked.public String[] getRootTableKeyColumnNames()
PostInsertIdentityPersisterThe names of the primary key columns in the root table.
getRootTableKeyColumnNames in interface PostInsertIdentityPersisterprotected String[] getSQLUpdateByRowIdStrings()
protected String[] getSQLLazyUpdateByRowIdStrings()
protected String getSQLSnapshotSelectString()
protected String[] getSQLDeleteStrings()
protected String[] getSQLInsertStrings()
protected String[] getSQLUpdateStrings()
protected String[] getSQLLazyUpdateStrings()
protected String getSQLIdentityInsertString()
The query that inserts a row, letting the database generate an id
protected String getVersionSelectString()
protected boolean isInsertCallable(int j)
protected boolean isUpdateCallable(int j)
protected boolean isDeleteCallable(int j)
protected boolean isSubclassPropertyDeferred(String propertyName, String entityName)
protected boolean isSubclassTableSequentialSelect(int j)
public boolean hasSequentialSelect()
protected boolean[] getTableUpdateNeeded(int[] dirtyProperties,
boolean hasDirtyCollection)
Decide which tables need to be updated. <p/> The return here is an array of boolean values with each index corresponding to a given table in the scope of this persister.
dirtyProperties - The indices of all the entity properties considered dirty.hasDirtyCollection - Whether any collections owned by the entity which were considered dirty.public boolean hasRowId()
LoadableDoes the result set contain rowids?
protected boolean[][] getPropertyColumnUpdateable()
protected boolean[][] getPropertyColumnInsertable()
protected boolean[] getPropertySelectable()
protected AbstractEntityPersister.CacheEntryHelper buildCacheEntryHelper()
public boolean canUseReferenceCacheEntries()
canUseReferenceCacheEntries in interface EntityPersisterprotected static String getTemplateFromString(String string, SessionFactoryImplementor factory)
protected Map<String,String> generateLazySelectStringsByFetchGroup()
public Object initializeLazyProperty(String fieldName, Object entity, SharedSessionContractImplementor session)
LazyPropertyInitializerInitialize the property, and return its new value.
initializeLazyProperty in interface LazyPropertyInitializerfieldName - The name of the field being initializedentity - The entity on which the initialization is occurringsession - The session from which the initialization originated.protected Serializable getCollectionKey(CollectionPersister persister, Object owner, EntityEntry ownerEntry, SharedSessionContractImplementor session)
public boolean isBatchable()
public NavigableRole getNavigableRole()
getNavigableRole in interface EntityPersisterpublic Serializable[] getQuerySpaces()
EntityPersisterReturns an array of objects that identify spaces in which properties of
this entity are persisted, for instances of this class and its subclasses.
<p/>
Much like EntityPersister.getPropertySpaces(), except that here we include subclass
entity spaces.
getQuerySpaces in interface EntityPersisterpublic boolean isBatchLoadable()
EntityPersisterIs batch loading enabled?
isBatchLoadable in interface EntityPersisterpublic String[] getIdentifierColumnNames()
LoadableGet the names of columns used to persist the identifier
getIdentifierColumnNames in interface PostInsertIdentityPersistergetIdentifierColumnNames in interface LoadablegetIdentifierColumnNames in interface Queryablepublic String[] getIdentifierColumnReaders()
public String[] getIdentifierColumnReaderTemplates()
protected int getIdentifierColumnSpan()
protected String[] getIdentifierAliases()
public String getVersionColumnName()
LockableFor versioned entities, get the name of the column (again, expected on the root table) used to store the version values.
getVersionColumnName in interface Lockableprotected String getVersionedTableName()
protected boolean[] getSubclassColumnLazyiness()
protected boolean[] getSubclassFormulaLazyiness()
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.
isCacheInvalidationRequired in interface EntityPersisterpublic boolean isLazyPropertiesCacheable()
EntityPersisterShould lazy properties of this entity be cached?
isLazyPropertiesCacheable in interface EntityPersisterpublic String selectFragment(String alias, String suffix)
OuterJoinLoadableGenerate a list of collection index, key and element columns
selectFragment in interface OuterJoinLoadableselectFragment in interface SQLLoadablepublic String[] getIdentifierAliases(String suffix)
LoadableGet the result set aliases used for the identifier columns, given a suffix
getIdentifierAliases in interface Loadablepublic String[] getPropertyAliases(String suffix, int i)
LoadableGet the result set aliases used for the property columns, given a suffix (properties of this class, only).
getPropertyAliases in interface Loadablepublic String getDiscriminatorAlias(String suffix)
LoadableGet the result set aliases used for the identifier columns, given a suffix
getDiscriminatorAlias in interface Loadablepublic String identifierSelectFragment(String name, String suffix)
QueryableGiven a query alias and an identifying suffix, render the identifier select fragment.
identifierSelectFragment in interface Queryablepublic String propertySelectFragment(String tableAlias, String suffix, boolean allProperties)
QueryableGiven a query alias and an identifying suffix, render the property select fragment.
propertySelectFragment in interface Queryablepublic SelectFragment propertySelectFragmentFragment(String tableAlias, String suffix, boolean allProperties)
propertySelectFragmentFragment in interface Queryablepublic Object[] getDatabaseSnapshot(Serializable id, SharedSessionContractImplementor session) throws HibernateException
EntityPersisterGet the current database state of the object, in a "hydrated" form, without resolving identifiers
getDatabaseSnapshot in interface EntityPersisterHibernateExceptionpublic Serializable getIdByUniqueKey(Serializable key, String uniquePropertyName, SharedSessionContractImplementor session) throws HibernateException
getIdByUniqueKey in interface EntityPersisterHibernateExceptionprotected String generateIdByUniqueKeySelectString(String uniquePropertyName)
protected String generateSelectVersionString()
Generate the SQL that selects the version number by id
public boolean[] getPropertyUniqueness()
protected String generateInsertGeneratedValuesSelectString()
protected String generateUpdateGeneratedValuesSelectString()
protected String concretePropertySelectFragment(String alias, boolean[] includeProperty)
protected String concretePropertySelectFragment(String alias, AbstractEntityPersister.InclusionChecker inclusionChecker)
protected String generateSnapshotSelectString()
public Object forceVersionIncrement(Serializable id, Object currentVersion, SharedSessionContractImplementor session)
forceVersionIncrement in interface EntityPersisterpublic Object getCurrentVersion(Serializable id, SharedSessionContractImplementor session) throws HibernateException
Retrieve the version number
getCurrentVersion in interface EntityPersisterHibernateExceptionprotected void initLockers()
protected LockingStrategy generateLocker(LockMode lockMode)
public void lock(Serializable id, Object version, Object object, LockMode lockMode, SharedSessionContractImplementor session) throws HibernateException
EntityPersisterDo a version check (optional operation)
lock in interface EntityPersisterHibernateExceptionpublic void lock(Serializable id, Object version, Object object, LockOptions lockOptions, SharedSessionContractImplementor session) throws HibernateException
EntityPersisterDo a version check (optional operation)
lock in interface EntityPersisterHibernateExceptionpublic String getRootTableName()
LockableLocks are always applied to the "root table".
getRootTableName in interface Lockablepublic String getRootTableAlias(String drivingAlias)
LockableGet the SQL alias this persister would use for the root table given the passed driving alias.
getRootTableAlias in interface LockabledrivingAlias - The driving alias; or the alias for the table
mapped by this persister in the hierarchy.public String[] getRootTableIdentifierColumnNames()
LockableGet the names of columns on the root table used to persist the identifier.
getRootTableIdentifierColumnNames in interface Lockablepublic String[] toColumns(String alias, String propertyName) throws QueryException
Obtain aliased column/formula fragments for the specified property path.
Warning: When there are duplicated property names in the subclasses then this method may return the wrong results. To ensure correct results, this method should only be used when this is the concrete EntityPersister (since the concrete EntityPersister cannot have duplicated property names).
toColumns in interface PropertyMappingQueryExceptionpublic String[] toColumns(String propertyName) throws QueryException
Given a property path, return the corresponding column name(s).
Warning: When there are duplicated property names in the subclasses then this method may return the wrong results. To ensure correct results, this method should only be used when this is the concrete EntityPersister (since the concrete EntityPersister cannot have duplicated property names).
toColumns in interface PropertyMappingQueryExceptionpublic Type toType(String propertyName) throws QueryException
Given a component path expression, get the type of the property
Warning: When there are duplicated property names in the subclasses then this method may return the wrong results. To ensure correct results, this method should only be used when this is the concrete EntityPersister (since the concrete EntityPersister cannot have duplicated property names).
toType in interface PropertyMappingQueryExceptionpublic String[] getPropertyColumnNames(String propertyName)
Get the column names for the given property path
Warning: When there are duplicated property names in the subclasses then this method may return the wrong results. To ensure correct results, this method should only be used when this is the concrete EntityPersister (since the concrete EntityPersister cannot have duplicated property names).
getPropertyColumnNames in interface OuterJoinLoadablepublic 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.
getSubclassPropertyTableNumber in interface QueryablepropertyPath - The name of the property.public Queryable.Declarer getSubclassPropertyDeclarer(String propertyPath)
QueryableDetermine whether the given property is declared by our
mapped class, our super class, or one of our subclasses…
<p/>
Note: the method is called 'subclass property…' simply
for consistency sake (e.g. Queryable.getSubclassPropertyTableNumber(java.lang.String)
getSubclassPropertyDeclarer in interface QueryablepropertyPath - The property name.public DiscriminatorMetadata getTypeDiscriminatorMetadata()
QueryableRetrieve the information needed to properly deal with this entity’s discriminator in a query.
getTypeDiscriminatorMetadata in interface Queryablepublic String[] toColumns(String name, int i)
OuterJoinLoadableGiven the number of a property of a subclass, and a table alias, return the aliased column names.
toColumns in interface OuterJoinLoadableprotected String[] getPropertySubclassNames()
public String[] getPropertyColumnNames(int i)
LoadableGet the result set column names mapped for this property (properties of this class, only).
getPropertyColumnNames in interface Loadablepublic String[] getPropertyColumnWriters(int i)
protected int getPropertyColumnSpan(int i)
protected boolean hasFormulaProperties()
public FetchMode getFetchMode(int i)
OuterJoinLoadableMay this (subclass closure) property be fetched using an SQL outerjoin?
getFetchMode in interface OuterJoinLoadablepublic CascadeStyle getCascadeStyle(int i)
OuterJoinLoadableGet the cascade style of this (subclass closure) property
getCascadeStyle in interface OuterJoinLoadablepublic Type getSubclassPropertyType(int i)
OuterJoinLoadableGet the type of the numbered property of the class or a subclass.
getSubclassPropertyType in interface OuterJoinLoadablepublic String getSubclassPropertyName(int i)
OuterJoinLoadableGet the name of the numbered property of the class or a subclass.
getSubclassPropertyName in interface OuterJoinLoadablepublic int countSubclassProperties()
OuterJoinLoadableHow many properties are there, for this class and all subclasses?
countSubclassProperties in interface OuterJoinLoadablepublic String[] getSubclassPropertyColumnNames(int i)
OuterJoinLoadableReturn the column names used to persist the numbered property of the class or a subclass.
getSubclassPropertyColumnNames in interface OuterJoinLoadablepublic boolean isDefinedOnSubclass(int i)
OuterJoinLoadableIs this property defined on a subclass of the mapped class.
isDefinedOnSubclass in interface OuterJoinLoadablepublic String[][] getSubclassPropertyFormulaTemplateClosure()
getSubclassPropertyFormulaTemplateClosure in interface Queryableprotected Type[] getSubclassPropertyTypeClosure()
protected String[][] getSubclassPropertyColumnNameClosure()
public String[][] getSubclassPropertyColumnReaderClosure()
public String[][] getSubclassPropertyColumnReaderTemplateClosure()
protected String[] getSubclassPropertyNameClosure()
public int[] resolveAttributeIndexes(String[] attributeNames)
EntityPersisterConverts an array of attribute names to a set of indexes, according to the entity metamodel
resolveAttributeIndexes in interface EntityPersisterattributeNames - Array of names to be resolvedprotected String[] getSubclassPropertySubclassNameClosure()
protected String[] getSubclassColumnClosure()
protected String[] getSubclassColumnAliasClosure()
public String[] getSubclassColumnReaderTemplateClosure()
protected String[] getSubclassFormulaClosure()
protected String[] getSubclassFormulaTemplateClosure()
protected String[] getSubclassFormulaAliasClosure()
public String[] getSubclassPropertyColumnAliases(String propertyName, String suffix)
SQLLoadableReturn the column alias names used to persist/query the named property of the class or a subclass (optional operation).
getSubclassPropertyColumnAliases in interface SQLLoadablepublic String[] getSubclassPropertyColumnNames(String propertyName)
SQLLoadableReturn the column names used to persist/query the named property of the class or a subclass (optional operation).
getSubclassPropertyColumnNames in interface SQLLoadableprotected void initSubclassPropertyAliasesMap(PersistentClass model) throws MappingException
Must be called by subclasses, at the end of their constructors
MappingExceptionpublic Object loadByUniqueKey(String propertyName, Object uniqueKey, SharedSessionContractImplementor session) throws HibernateException
UniqueKeyLoadableLoad an instance of the persistent class, by a unique key other than the primary key.
loadByUniqueKey in interface UniqueKeyLoadableHibernateExceptionpublic int getPropertyIndex(String propertyName)
UniqueKeyLoadableGet the property number of the unique key property
getPropertyIndex in interface UniqueKeyLoadableprotected void createUniqueKeyLoaders()
throws MappingException
MappingExceptionprotected boolean hasWhere()
protected void initPropertyPaths(Mapping mapping) throws MappingException
MappingExceptionprotected UniqueEntityLoader createEntityLoader(LockMode lockMode, LoadQueryInfluencers loadQueryInfluencers) throws MappingException
MappingExceptionprotected UniqueEntityLoader createEntityLoader(LockOptions lockOptions, LoadQueryInfluencers loadQueryInfluencers) throws MappingException
MappingExceptionprotected UniqueEntityLoader createEntityLoader(LockMode lockMode) throws MappingException
Used internally to create static loaders. These are the default set of loaders used to handle get()/load()
processing. lock() handling is done by the LockingStrategy instances (see getLocker(org.hibernate.LockMode))
lockMode - The lock mode to apply to the thing being loaded.MappingExceptionprotected boolean check(int rows,
Serializable id,
int tableNumber,
Expectation expectation,
PreparedStatement statement)
throws HibernateException
HibernateExceptionprotected String generateUpdateString(boolean[] includeProperty, int j, boolean useRowId)
protected String generateUpdateString(boolean[] includeProperty, int j, Object[] oldFields, boolean useRowId)
Generate the SQL that updates a row by id (and version)
protected final boolean checkVersion(boolean[] includeProperty)
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 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.
includeProperty - indices of the properties to include in the
insert statement.protected String generateDeleteString(int j)
Generate the SQL that deletes a row by id (and version)
protected int dehydrate(Serializable id, Object[] fields, boolean[] includeProperty, boolean[][] includeColumns, int j, PreparedStatement st, SharedSessionContractImplementor session, boolean isUpdate) throws HibernateException, SQLException
HibernateExceptionSQLExceptionprotected int dehydrate(Serializable id, Object[] fields, Object rowId, boolean[] includeProperty, boolean[][] includeColumns, int j, PreparedStatement ps, SharedSessionContractImplementor session, int index, boolean isUpdate) throws SQLException, HibernateException
Marshall the fields of a persistent instance to a prepared statement
SQLExceptionHibernateExceptionpublic Object[] hydrate(ResultSet rs, Serializable id, Object object, Loadable rootLoadable, String[][] suffixedPropertyColumns, boolean allProperties, SharedSessionContractImplementor session) throws SQLException, HibernateException
Unmarshall the fields of a persistent instance from a result set, without resolving associations or collections. Question: should this really be here, or should it be sent back to Loader?
hydrate in interface LoadableSQLExceptionHibernateExceptionprotected boolean useInsertSelectIdentity()
protected boolean useGetGeneratedKeys()
protected Serializable insert(Object[] fields, boolean[] notNull, String sql, Object object, SharedSessionContractImplementor session) throws HibernateException
Perform an SQL INSERT, and then retrieve a generated identifier. <p/> This form is used for PostInsertIdentifierGenerator-style ids (IDENTITY, select, etc).
HibernateExceptionpublic String getIdentitySelectString()
PostInsertIdentityPersisterGet the database-specific SQL command to retrieve the last generated IDENTITY value.
getIdentitySelectString in interface PostInsertIdentityPersisterpublic String getSelectByUniqueKeyString(String propertyName)
PostInsertIdentityPersisterGet a SQL select string that performs a select based on a unique key determined by the given property name).
getSelectByUniqueKeyString in interface PostInsertIdentityPersisterpropertyName - The name of the property which maps to the
column(s) to use in the select statement restriction.protected void insert(Serializable id, Object[] fields, boolean[] notNull, int j, String sql, Object object, SharedSessionContractImplementor session) throws HibernateException
Perform an SQL INSERT. <p/> 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.
HibernateExceptionprotected void updateOrInsert(Serializable id, Object[] fields, Object[] oldFields, Object rowId, boolean[] includeProperty, int j, Object oldVersion, Object object, String sql, SharedSessionContractImplementor session) throws HibernateException
Perform an SQL UPDATE or SQL INSERT
HibernateExceptionprotected boolean update(Serializable id, Object[] fields, Object[] oldFields, Object rowId, boolean[] includeProperty, int j, Object oldVersion, Object object, String sql, SharedSessionContractImplementor session) throws HibernateException
HibernateExceptionprotected void delete(Serializable id, Object version, int j, Object object, String sql, SharedSessionContractImplementor session, Object[] loadedState) throws HibernateException
Perform an SQL DELETE
HibernateExceptionpublic void update(Serializable id, Object[] fields, int[] dirtyFields, boolean hasDirtyCollection, Object[] oldFields, Object oldVersion, Object object, Object rowId, SharedSessionContractImplementor session) throws HibernateException
Update an object
update in interface EntityPersisterHibernateExceptionpublic Serializable insert(Object[] fields, Object object, SharedSessionContractImplementor session) throws HibernateException
EntityPersisterPersist an instance, using a natively generated identifier (optional operation)
insert in interface EntityPersisterHibernateExceptionpublic void insert(Serializable id, Object[] fields, Object object, SharedSessionContractImplementor session)
EntityPersisterPersist an instance
insert in interface EntityPersisterpublic void delete(Serializable id, Object version, Object object, SharedSessionContractImplementor session) throws HibernateException
Delete an object
delete in interface EntityPersisterHibernateExceptionprotected void logStaticSQL()
public String filterFragment(String alias, Map enabledFilters) throws MappingException
JoinableGet the where clause filter, given a query alias and considering enabled session filters
filterFragment in interface JoinableMappingExceptionpublic String filterFragment(String alias, Map enabledFilters, Set<String> treatAsDeclarations)
JoinableGet the where clause filter, given a query alias and considering enabled session filters
filterFragment in interface Joinablepublic String generateFilterConditionAlias(String rootAlias)
QueryableThe alias used for any filter conditions (mapped where-fragments or enabled-filters). </p> This may or may not be different from the root alias depending upon the inheritance mapping strategy.
generateFilterConditionAlias in interface QueryablerootAlias - The root aliaspublic String oneToManyFilterFragment(String alias) throws MappingException
oneToManyFilterFragment in interface JoinableMappingExceptionpublic String oneToManyFilterFragment(String alias, Set<String> treatAsDeclarations)
oneToManyFilterFragment in interface Joinablepublic String fromJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses)
JoinableGet the from clause part of any joins (optional operation)
fromJoinFragment in interface Joinablepublic String fromJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses, Set<String> treatAsDeclarations)
JoinableGet the from clause part of any joins (optional operation)
fromJoinFragment in interface Joinablepublic String whereJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses)
JoinableGet the where clause part of any joins (optional operation)
whereJoinFragment in interface Joinablepublic String whereJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses, Set<String> treatAsDeclarations)
JoinableGet the where clause part of any joins (optional operation)
whereJoinFragment in interface Joinableprotected boolean isSubclassTableLazy(int j)
protected JoinFragment createJoin(String name, boolean innerJoin, boolean includeSubclasses, Set<String> treatAsDeclarations)
protected JoinType determineSubclassTableJoinType(int subclassTableNumber, boolean canInnerJoin, boolean includeSubclasses, Set<String> treatAsDeclarations)
protected boolean isSubclassTableIndicatedByTreatAsDeclarations(int subclassTableNumber,
Set<String> treatAsDeclarations)
protected JoinFragment createJoin(int[] tableNumbers, String drivingAlias)
protected SelectFragment createSelect(int[] subclassColumnNumbers, int[] subclassFormulaNumbers)
protected String renderSelect(int[] tableNumbers, int[] columnNumbers, int[] formulaNumbers)
protected void postConstruct(Mapping mapping) throws MappingException
Post-construct is a callback for AbstractEntityPersister subclasses to call after they are all done with their constructor processing. It allows AbstractEntityPersister to extend its construction after all subclass-specific details have been handled.
mapping - The mappingMappingException - Indicates a problem accessing the Mappingpublic final void postInstantiate()
throws MappingException
EntityPersisterFinish the initialization of this object. EntityPersister.generateEntityDefinition()
must be called for all entity persisters before calling this method.
<p/>
Called only once per SessionFactory lifecycle,
after all entity persisters have been instantiated.
postInstantiate in interface EntityPersisterMappingException - Indicates an issue in the metadata.protected void doPostInstantiate()
@Deprecated protected Map getLoaders()
"Needed" by subclasses to override the createLoader strategy
protected void createLoaders()
protected final UniqueEntityLoader getLoaderByLockMode(LockMode lockMode)
protected void createQueryLoader()
public Object load(Serializable id, Object optionalObject, LockMode lockMode, SharedSessionContractImplementor session)
Load an instance using either the <tt>forUpdateLoader</tt> or the outer joining <tt>loader</tt>, depending upon the value of the <tt>lock</tt> parameter
load in interface EntityPersisterpublic Object load(Serializable id, Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session) throws HibernateException
Load an instance using either the <tt>forUpdateLoader</tt> or the outer joining <tt>loader</tt>, depending upon the value of the <tt>lock</tt> parameter
load in interface EntityPersisterHibernateExceptionpublic List multiLoad(Serializable[] ids, SharedSessionContractImplementor session, MultiLoadOptions loadOptions)
EntityPersisterPerforms a load of multiple entities (of this type) by identifier simultaneously.
multiLoad in interface EntityPersisterids - The identifiers to loadsession - The originating SesisonloadOptions - The options for loadingpublic void registerAffectingFetchProfile(String fetchProfileName)
LoadableRegister the name of a fetch profile determined to have an affect on the underlying loadable in regards to the fact that the underlying load SQL needs to be adjust when the given fetch profile is enabled.
registerAffectingFetchProfile in interface LoadablefetchProfileName - The name of the profile affecting this.protected UniqueEntityLoader getAppropriateLoader(LockOptions lockOptions, SharedSessionContractImplementor session)
protected final boolean isAllNull(Object[] array, int tableNumber)
public boolean isSubclassPropertyNullable(int i)
OuterJoinLoadableIs the numbered property of the class of subclass nullable?
isSubclassPropertyNullable in interface OuterJoinLoadableprotected final boolean[] getPropertiesToUpdate(int[] dirtyProperties,
boolean hasDirtyCollection)
Transform the array of property indexes to an array of booleans, true when the property is dirty
protected boolean[] getPropertiesToInsert(Object[] fields)
Transform the array of property indexes to an array of booleans, true when the property is insertable and non-null
public int[] findDirty(Object[] currentState, Object[] previousState, Object entity, SharedSessionContractImplementor session) throws HibernateException
Locate the property-indices of all properties considered to be dirty.
findDirty in interface EntityPersistercurrentState - 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 occurring.HibernateExceptionpublic int[] findModified(Object[] old, Object[] current, Object entity, SharedSessionContractImplementor session) throws HibernateException
Locate the property-indices of all properties considered to be dirty.
findModified in interface EntityPersisterold - 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 occurring.HibernateExceptionprotected boolean[] getPropertyUpdateability(Object entity)
Which properties appear in the SQL update? (Initialized, updateable ones!)
public SessionFactoryImplementor getFactory()
EntityPersisterReturn the SessionFactory to which this persister "belongs".
getFactory in interface EntityPersisterpublic EntityMetamodel getEntityMetamodel()
EntityPersisterRetrieve the underlying entity metamodel instance…
getEntityMetamodel in interface EntityPersisterpublic boolean canReadFromCache()
canReadFromCache in interface EntityPersisterpublic boolean canWriteToCache()
canWriteToCache in interface EntityPersisterpublic boolean hasCache()
EntityPersisterDoes this class have a cache.
hasCache in interface EntityPersisterpublic EntityDataAccess getCacheAccessStrategy()
EntityPersisterGet the cache (optional operation)
getCacheAccessStrategy in interface EntityPersisterpublic CacheEntryStructure getCacheEntryStructure()
EntityPersisterGet the cache structure
getCacheEntryStructure in interface EntityPersisterpublic CacheEntry buildCacheEntry(Object entity, Object[] state, Object version, SharedSessionContractImplementor session)
buildCacheEntry in interface EntityPersisterpublic boolean hasNaturalIdCache()
EntityPersisterDoes this class have a natural id cache
hasNaturalIdCache in interface EntityPersisterpublic NaturalIdDataAccess getNaturalIdCacheAccessStrategy()
EntityPersisterGet the NaturalId cache (optional operation)
getNaturalIdCacheAccessStrategy in interface EntityPersisterpublic Comparator getVersionComparator()
public final String getEntityName()
EntityPersisterThe entity name which this persister maps.
getEntityName in interface ClassMetadatagetEntityName in interface EntityPersisterpublic EntityType getEntityType()
getEntityType in interface OuterJoinLoadablepublic boolean isPolymorphic()
public boolean isInherited()
EntityPersisterDetermine whether the entity is inherited one or more other entities. In other words, is this entity a subclass of other entities.
isInherited in interface ClassMetadataisInherited in interface EntityPersisterpublic boolean hasCascades()
EntityPersisterDetermine whether this entity has any non-none cascading.
hasCascades in interface EntityPersisterpublic boolean hasIdentifierProperty()
EntityPersisterDetermine whether the entity has a particular property holding the identifier value.
hasIdentifierProperty in interface ClassMetadatahasIdentifierProperty in interface EntityPersisterpublic VersionType getVersionType()
EntityPersisterIf EntityPersister.isVersioned(), then what is the type of the property
holding the locking value.
getVersionType in interface EntityPersisterpublic int getVersionProperty()
EntityPersisterIf EntityPersister.isVersioned(), then what is the index of the property
holding the locking value.
getVersionProperty in interface ClassMetadatagetVersionProperty in interface EntityPersisterpublic boolean isVersioned()
EntityPersisterDetermine whether optimistic locking by column is enabled for this entity.
isVersioned in interface ClassMetadataisVersioned in interface EntityPersisterpublic boolean isIdentifierAssignedByInsert()
EntityPersisterAre identifiers of this entity assigned known before the insert execution? Or, are they generated (in the database) by the insert execution.
isIdentifierAssignedByInsert in interface EntityPersisterpublic boolean hasLazyProperties()
EntityPersisterDetermine whether this entity defines any lazy properties (ala bytecode instrumentation).
hasLazyProperties in interface EntityPersisterpublic void afterReassociate(Object entity, SharedSessionContractImplementor session)
EntityPersisterCalled just after the entity has been reassociated with the session
afterReassociate in interface EntityPersisterpublic Boolean isTransient(Object entity, SharedSessionContractImplementor session) throws HibernateException
EntityPersisterIs this a new transient instance?
isTransient in interface EntityPersisterHibernateExceptionpublic boolean hasCollections()
EntityPersisterDetermine whether this entity contains references to persistent collections.
hasCollections in interface EntityPersisterpublic boolean hasMutableProperties()
EntityPersisterDetermine whether any properties of this entity are considered mutable.
hasMutableProperties in interface EntityPersisterpublic boolean isMutable()
EntityPersisterDetermine whether instances of this entity are considered mutable.
isMutable in interface ClassMetadataisMutable in interface EntityPersisterprotected final boolean isModifiableEntity(EntityEntry entry)
public boolean isAbstract()
QueryableIs this an abstract class?
isAbstract in interface LoadableisAbstract in interface Queryablepublic boolean hasSubclasses()
LoadableDoes this persistent class have subclasses?
hasSubclasses in interface ClassMetadatahasSubclasses in interface Loadablepublic boolean hasProxy()
EntityPersisterDetermine whether this entity supports dynamic proxies.
hasProxy in interface ClassMetadatahasProxy in interface EntityPersisterpublic IdentifierGenerator getIdentifierGenerator() throws HibernateException
EntityPersisterDetermine which identifier generation strategy is used for this entity.
getIdentifierGenerator in interface EntityPersisterHibernateExceptionpublic String getRootEntityName()
EntityPersisterReturns an object that identifies the space in which identifiers of this entity hierarchy are unique. Might be a table name, a JNDI URL, etc.
getRootEntityName in interface EntityPersisterpublic ClassMetadata getClassMetadata()
EntityPersisterGet the user-visible metadata for the class (optional operation)
getClassMetadata in interface EntityPersisterpublic String getMappedSuperclass()
QueryableGet the class that this class is mapped as a subclass of - not necessarily the direct superclass
getMappedSuperclass in interface Queryablepublic boolean isExplicitPolymorphism()
QueryableIs this class explicit polymorphism only?
isExplicitPolymorphism in interface Queryableprotected boolean useDynamicUpdate()
protected boolean useDynamicInsert()
protected boolean hasEmbeddedCompositeIdentifier()
public boolean canExtractIdOutOfEntity()
EntityPersisterDetermine whether detached instances of this entity carry their own identifier value. <p/> The other option is the deprecated feature where users could supply the id during session calls.
canExtractIdOutOfEntity in interface EntityPersisterEntityPersister.hasIdentifierProperty() or
(2) the identifier is an embedded composite identifier; false otherwise.public String[] getKeyColumnNames()
JoinableThe columns to join on
getKeyColumnNames in interface Joinablepublic String getName()
JoinableAn identifying name; a class name or collection role name.
public boolean isCollection()
JoinableIs this instance actually a CollectionPersister?
isCollection in interface Joinablepublic boolean consumesEntityAlias()
JoinableVery, very, very ugly…
consumesEntityAlias in interface Joinablepublic boolean consumesCollectionAlias()
JoinableVery, very, very ugly…
consumesCollectionAlias in interface Joinablepublic Type getPropertyType(String propertyName) throws MappingException
Get the type of a particular property by name.
Warning: When there are duplicated property names in the subclasses then this method may return the wrong results. To ensure correct results, this method should only be used when this is the concrete EntityPersister (since the concrete EntityPersister cannot have duplicated property names).
getPropertyType in interface ClassMetadatagetPropertyType in interface EntityPersisterpropertyName - The name of the property for which to retrieve
the type.MappingException - Typically indicates an unknown
property name.public Type getType()
PropertyMappingGet the type of the thing containing the properties
getType in interface PropertyMappinggetType in interface SQLLoadablepublic boolean isSelectBeforeUpdateRequired()
EntityPersisterIs select snapshot before update enabled?
isSelectBeforeUpdateRequired in interface EntityPersisterprotected final OptimisticLockStyle optimisticLockStyle()
public Object createProxy(Serializable id, SharedSessionContractImplementor session) throws HibernateException
EntityPersisterCreate a new proxy instance
createProxy in interface EntityPersisterHibernateExceptionpublic final String selectFragment(Joinable rhs, String rhsAlias, String lhsAlias, String entitySuffix, String collectionSuffix, boolean includeCollectionColumns)
JoinableAll columns to select, when loading.
selectFragment in interface Joinablepublic boolean isInstrumented()
EntityPersisterHas the class actually been bytecode instrumented?
isInstrumented in interface EntityPersisterpublic boolean hasInsertGeneratedProperties()
EntityPersisterDoes this entity define any properties as being database generated on insert?
hasInsertGeneratedProperties in interface EntityPersisterpublic boolean hasUpdateGeneratedProperties()
EntityPersisterDoes this entity define any properties as being database generated on update?
hasUpdateGeneratedProperties in interface EntityPersisterpublic boolean isVersionPropertyGenerated()
EntityPersisterDoes this entity contain a version property that is defined to be database generated?
isVersionPropertyGenerated in interface EntityPersisterpublic boolean isVersionPropertyInsertable()
QueryableIs the version property included in insert statements?
isVersionPropertyInsertable in interface Queryablepublic void afterInitialize(Object entity, SharedSessionContractImplementor session)
EntityPersisterCalled just after the entities properties have been initialized
afterInitialize in interface EntityPersisterpublic String[] getPropertyNames()
EntityPersisterGet the names of the class properties - doesn’t have to be the names of the actual Java properties (used for XML generation only)
getPropertyNames in interface ClassMetadatagetPropertyNames in interface EntityPersisterpublic Type[] getPropertyTypes()
EntityPersisterGet the Hibernate types of the class properties
getPropertyTypes in interface ClassMetadatagetPropertyTypes in interface EntityPersisterpublic boolean[] getPropertyLaziness()
ClassMetadataGet the "laziness" of the properties of this class
getPropertyLaziness in interface ClassMetadatagetPropertyLaziness in interface EntityPersisterpublic boolean[] getPropertyUpdateability()
EntityPersisterGet the "updateability" of the properties of this class (does the property appear in an SQL UPDATE)
getPropertyUpdateability in interface EntityPersisterpublic boolean[] getPropertyCheckability()
EntityPersisterGet the "checkability" of the properties of this class (is the property dirty checked, does the cache need to be updated)
getPropertyCheckability in interface EntityPersisterpublic boolean[] getNonLazyPropertyUpdateability()
public boolean[] getPropertyInsertability()
EntityPersisterGet the "insertability" of the properties of this class (does the property appear in an SQL INSERT)
getPropertyInsertability in interface EntityPersister@Deprecated public ValueInclusion[] getPropertyInsertGenerationInclusions()
EntityPersisterWhich of the properties of this class are database generated values on insert?
getPropertyInsertGenerationInclusions in interface EntityPersister@Deprecated public ValueInclusion[] getPropertyUpdateGenerationInclusions()
EntityPersisterWhich of the properties of this class are database generated values on update?
getPropertyUpdateGenerationInclusions in interface EntityPersisterpublic boolean[] getPropertyNullability()
EntityPersisterGet the nullability of the properties of this class
getPropertyNullability in interface ClassMetadatagetPropertyNullability in interface EntityPersisterpublic boolean[] getPropertyVersionability()
EntityPersisterGet the "versionability" of the properties of this class (is the property optimistic-locked)
getPropertyVersionability in interface EntityPersisterpublic CascadeStyle[] getPropertyCascadeStyles()
EntityPersisterGet the cascade styles of the properties (optional operation)
getPropertyCascadeStyles in interface EntityPersisterpublic final Class getMappedClass()
EntityPersisterThe persistent class, or null
getMappedClass in interface ClassMetadatagetMappedClass in interface EntityPersisterpublic boolean implementsLifecycle()
EntityPersisterDoes the class implement the Lifecycle interface.
implementsLifecycle in interface ClassMetadataimplementsLifecycle in interface EntityPersisterpublic Class getConcreteProxyClass()
EntityPersisterGet the proxy interface that instances of <em>this</em> concrete class will be cast to (optional operation).
getConcreteProxyClass in interface EntityPersisterpublic void setPropertyValues(Object object, Object[] values)
EntityPersisterSet the given values to the mapped properties of the given object
setPropertyValues in interface ClassMetadatasetPropertyValues in interface EntityPersisterpublic void setPropertyValue(Object object, int i, Object value)
EntityPersisterSet the value of a particular property
setPropertyValue in interface EntityPersisterpublic Object[] getPropertyValues(Object object)
EntityPersisterReturn the (loaded) values of the mapped properties of the object (not including backrefs)
getPropertyValues in interface ClassMetadatagetPropertyValues in interface EntityPersisterobject - The entity from which to extract the property values.public Object getPropertyValue(Object object, int i)
EntityPersisterGet the value of a particular property
getPropertyValue in interface EntityPersisterpublic Object getPropertyValue(Object object, String propertyName)
EntityPersisterGet the value of a particular property
getPropertyValue in interface ClassMetadatagetPropertyValue in interface EntityPersisterpublic Serializable getIdentifier(Object object)
EntityPersisterGet the identifier of an instance (throw an exception if no identifier property)
getIdentifier in interface ClassMetadatagetIdentifier in interface EntityPersisterpublic Serializable getIdentifier(Object entity, SharedSessionContractImplementor session)
EntityPersisterGet the identifier of an instance (throw an exception if no identifier property)
getIdentifier in interface ClassMetadatagetIdentifier in interface EntityPersisterentity - The entity for which to get the identifiersession - The session from which the request originatedpublic void setIdentifier(Object entity, Serializable id, SharedSessionContractImplementor session)
EntityPersisterInject the identifier value into the given entity.
setIdentifier in interface ClassMetadatasetIdentifier in interface EntityPersisterentity - The entity to inject with the identifier value.id - The value to be injected as the identifier.session - The session from which is requests originatespublic Object getVersion(Object object)
EntityPersisterGet the version number (or timestamp) from the object’s version property (or return null if not versioned)
getVersion in interface ClassMetadatagetVersion in interface EntityPersisterpublic Object instantiate(Serializable id, SharedSessionContractImplementor session)
EntityPersisterCreate a class instance initialized with the given identifier
instantiate in interface ClassMetadatainstantiate in interface EntityPersisterid - The identifier value to use (may be null to represent no value)session - The session from which the request originated.public boolean isInstance(Object object)
EntityPersisterIs the given object an instance of this entity?
isInstance in interface EntityPersisterpublic boolean hasUninitializedLazyProperties(Object object)
EntityPersisterDoes the given instance have any uninitialized lazy properties?
hasUninitializedLazyProperties in interface EntityPersisterpublic void resetIdentifier(Object entity, Serializable currentId, Object currentVersion, SharedSessionContractImplementor session)
EntityPersisterSet the identifier and version of the given instance back to its "unsaved" value.
resetIdentifier in interface EntityPersisterentity - The entity instancecurrentId - The currently assigned identifier value.currentVersion - The currently assigned version value.session - The session from which the request originated.public EntityPersister getSubclassEntityPersister(Object instance, SessionFactoryImplementor factory)
EntityPersisterA request has already identified the entity-name of this persister as the mapping for the given instance. However, we still need to account for possible subclassing and potentially re-route to the more appropriate persister. <p/> For example, a request names <tt>Animal</tt> as the entity-name which gets resolved to this persister. But the actual instance is really an instance of <tt>Cat</tt> which is a subclass of <tt>Animal</tt>. So, here the <tt>Animal</tt> persister is being asked to return the persister specific to <tt>Cat</tt>. <p/> It is also possible that the instance is actually an <tt>Animal</tt> instance in the above example in which case we would return <tt>this</tt> from this method.
getSubclassEntityPersister in interface EntityPersisterinstance - The entity instancefactory - Reference to the SessionFactorypublic boolean isMultiTable()
QueryableIs the inheritance hierarchy described by this persister contained across multiple tables?
isMultiTable in interface Queryableprotected int getPropertySpan()
public Object[] getPropertyValuesToInsert(Object object, Map mergeMap, SharedSessionContractImplementor session) throws HibernateException
EntityPersisterReturn the values of the insertable properties of the object (including backrefs)
getPropertyValuesToInsert in interface ClassMetadatagetPropertyValuesToInsert in interface EntityPersisterHibernateExceptionpublic void processInsertGeneratedProperties(Serializable id, Object entity, Object[] state, SharedSessionContractImplementor session)
EntityPersisterPerform a select to retrieve the values of any generated properties
back from the database, injecting these generated values into the
given entity as well as writing this state to the
PersistenceContext.
<p/>
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.
processInsertGeneratedProperties in interface EntityPersisterid - The entity’s id value.entity - The entity for which to get the state.session - The sessionpublic void processUpdateGeneratedProperties(Serializable id, Object entity, Object[] state, SharedSessionContractImplementor session)
EntityPersisterPerform a select to retrieve the values of any generated properties
back from the database, injecting these generated values into the
given entity as well as writing this state to the
PersistenceContext.
<p/>
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.
processUpdateGeneratedProperties in interface EntityPersisterid - The entity’s id value.entity - The entity for which to get the state.session - The sessionpublic String getIdentifierPropertyName()
EntityPersisterGet the name of the identifier property (or return null) - need not return the name of an actual Java property
getIdentifierPropertyName in interface ClassMetadatagetIdentifierPropertyName in interface EntityPersisterpublic Type getIdentifierType()
EntityPersisterGet the identifier type
getIdentifierType in interface ClassMetadatagetIdentifierType in interface EntityPersisterpublic boolean hasSubselectLoadableCollections()
EntityPersisterDetermine whether this entity contains references to persistent collections which are fetchable by subselect?
hasSubselectLoadableCollections in interface EntityPersisterpublic int[] getNaturalIdentifierProperties()
EntityPersisterIf the entity defines a natural id (EntityPersister.hasNaturalIdentifier()), which
properties make up the natural id.
getNaturalIdentifierProperties in interface ClassMetadatagetNaturalIdentifierProperties in interface EntityPersisterpublic Object[] getNaturalIdentifierSnapshot(Serializable id, SharedSessionContractImplementor session) throws HibernateException
EntityPersisterRetrieve the current state of the natural-id properties from the database.
getNaturalIdentifierSnapshot in interface EntityPersisterid - The identifier of the entity for which to retrieve the natural-id values.session - The session from which the request originated.HibernateExceptionpublic Serializable loadEntityIdByNaturalId(Object[] naturalIdValues, LockOptions lockOptions, SharedSessionContractImplementor session)
EntityPersisterLoad the id for the entity based on the natural id.
loadEntityIdByNaturalId in interface EntityPersisterprotected boolean isNaturalIdNonNullable()
protected String concretePropertySelectFragmentSansLeadingComma(String alias, boolean[] include)
public boolean hasNaturalIdentifier()
EntityPersisterDetermine whether this entity defines a natural identifier.
hasNaturalIdentifier in interface ClassMetadatahasNaturalIdentifier in interface EntityPersisterpublic void setPropertyValue(Object object, String propertyName, Object value)
ClassMetadataSet the value of a particular (named) property
setPropertyValue in interface ClassMetadatapublic EntityMode getEntityMode()
getEntityMode in interface EntityPersisterpublic EntityTuplizer getEntityTuplizer()
getEntityTuplizer in interface EntityPersisterpublic BytecodeEnhancementMetadata getInstrumentationMetadata()
getInstrumentationMetadata in interface EntityPersisterpublic String getTableAliasForColumn(String columnName, String rootAlias)
LoadableGiven a column name and the root table alias in use for the entity hierarchy, determine the proper table alias
for the table in that hierarchy that contains said column.
<p/>
NOTE : Generally speaking the column is not validated to exist. Most implementations simply return the
root alias; the exception is JoinedSubclassEntityPersister
getTableAliasForColumn in interface LoadablecolumnName - The column namerootAlias - The hierarchy root aliaspublic int determineTableNumberForColumn(String columnName)
protected String determineTableName(Table table, JdbcEnvironment jdbcEnvironment)
public EntityEntryFactory getEntityEntryFactory()
EntityPersisterGet the EntityEntryFactory indicated for the entity mapped by this persister.
getEntityEntryFactory in interface EntityPersisterpublic void generateEntityDefinition()
EntityPersisterGenerate the entity definition for this object. This must be done for all
entity persisters before calling EntityPersister.postInstantiate().
generateEntityDefinition in interface EntityPersisterpublic EntityPersister getEntityPersister()
getEntityPersister in interface EntityDefinitionpublic EntityIdentifierDefinition getEntityKeyDefinition()
getEntityKeyDefinition in interface EntityDefinitionpublic Iterable<AttributeDefinition> getAttributes()
getAttributes in interface AttributeSourceCopyright © 2001-2018 Red Hat, Inc. All Rights Reserved.