X - The represented entity typepublic class EntityTypeImpl<X> extends IdentifiableTypeImpl<X> implements javax.persistence.metamodel.EntityType<X>, EntityTypeDescriptor
EntityType.| Constructor and Description |
|---|
EntityTypeImpl(MetamodelImpl metamodel,
IdentifiableTypeImpl<? super X> parent,
Class<X> javaType,
EntityMetadata metadata) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addAttribute(AttributeImpl<? super X,?> attribute)
Adds the attribute into attributes.
|
boolean |
canBatchRemoves()
Returns if remove operation can be combined into a batch.
|
boolean |
extendz(EntityTypeImpl<?> parent)
Returns if this entity extends the parent entity.
|
void |
fireCallbacks(Object instance,
EntityListenerMetadata.EntityListenerType type)
Fires the callbacks.
|
EntityTable[] |
getAllTables()
Returns all the tables in the inheritance chain.
|
AssociationMetadata |
getAssociationOverride(String path)
Returns if attribute with the
path is overridden by the entity. |
AssociationMappingImpl<?,?,?>[] |
getAssociations()
Returns the associations of the type.
|
AssociationMappingImpl<?,?,?>[] |
getAssociationsDetachable()
Returns the associated attributes that are detachable by the type.
|
AssociationMappingImpl<?,?,?>[] |
getAssociationsJoined()
Returns the associated attributes that are joined.
|
AssociationMappingImpl<?,?,?>[] |
getAssociationsNotPersistable()
Returns the plural associations that are not persistable.
|
AssociationMappingImpl<?,?,?>[] |
getAssociationsPersistable()
Returns the associated attributes that are persistable by the type.
|
PluralAssociationMappingImpl<?,?,?>[] |
getAssociationsPlural()
Returns the plural associations.
|
AssociationMappingImpl<?,?,?>[] |
getAssociationsRemovable()
Returns the associated mappings that are removable by the type.
|
SingularAssociationMappingImpl<?,?>[] |
getAssociationsSingular()
Returns the singular associated mappings.
|
SingularAssociationMappingImpl<?,?>[] |
getAssociationsSingularOwnerLazy()
Returns the array of singular owner lazy association of the type.
|
ColumnMetadata |
getAttributeOverride(String path)
Returns if attribute with the
path is overridden by the entity. |
BasicMappingImpl<?,?>[] |
getBasicMappings()
Returns the basic mappings of the type.
|
Class<X> |
getBindableJavaType() |
javax.persistence.metamodel.Bindable.BindableType |
getBindableType() |
EntityTypeImpl<? extends X> |
getChildType(String discriminatorValue)
Returns the child based on the
discriminatorValue value. |
AssociationMappingImpl<?,?,?>[] |
getDependenciesFor(EntityTypeImpl<?> associate)
Returns the dependencies for the associate type
|
int |
getDependencyCount()
Returns the dependencyCount.
|
DiscriminatorColumn |
getDiscriminatorColumn()
Returns the discriminator column of the entity.
|
Set<String> |
getDiscriminators()
Returns the set of discriminator values in the range of this entity's hierarchy.
|
String |
getDiscriminatorValue()
Returns the discriminatorValue of the EntityTypeImpl.
|
ManagedId<X> |
getId(Object instance)
Returns the id of the entity from the instance.
|
ManagedId<X> |
getId(SessionImpl session,
ResultSet row)
Returns the id of the entity from the resultset row.
|
ManagedId<X> |
getId(SessionImpl session,
ResultSet row,
HashMap<AbstractColumn,String> idFields)
Returns the id of the entity from the resultset row.
|
SingularMappingEx<? super X,?> |
getIdMapping()
Returns the single id mapping.
|
Pair<SingularMapping<?,?>,AbstractAccessor>[] |
getIdMappings()
Returns an array of id attributes.
|
javax.persistence.InheritanceType |
getInheritanceType()
Returns the inheritance type of the entity.
|
Object |
getInstanceId(X instance)
Returns the id of the instance.
|
ManagedInstance<X> |
getManagedInstance(SessionImpl session,
X instance)
Returns the managed instance for the instance.
|
ManagedInstance<X> |
getManagedInstanceById(SessionImpl session,
ManagedId<X> id,
boolean lazy)
Creates a new managed instance with the id.
|
Object |
getMappedId(String name,
Object instance)
Returns the mapped id.
|
JoinedMapping<?,?,?>[] |
getMappingsJoined()
Retuns the element collection mappings.
|
PluralMappingEx<?,?,?>[] |
getMappingsPlural()
Retuns the element collection mappings.
|
PluralMappingEx<?,?,?>[] |
getMappingsPluralSorted()
Returns the sorted plural associations.
|
AbstractMapping<?,?,?>[] |
getMappingsSingular()
Returns the singular mappings.
|
String |
getName()
Returns the name of the type.
|
EntityTypeImpl<? super X> |
getParent()
Returns the parent of the entity.
|
javax.persistence.metamodel.Type.PersistenceType |
getPersistenceType() |
EntityTable |
getPrimaryTable()
Returns the primary table of the type
|
EntityMapping<X> |
getRootMapping()
Returns the entityMapping of the EntityTypeImpl.
|
EntityTypeImpl<? super X> |
getRootType()
Returns the root type of the hierarchy.
|
AbstractTable |
getTable(String tableName)
Returns the table with the name.
|
EntityTable[] |
getTables()
Returns the tables of the type, starting from the top of the hierarchy.
|
boolean |
isIdMethod(Method method)
Returns if the method is an id method.
|
boolean |
isRoot()
Returns if the entity is the root of the hierarchy.
|
boolean |
isSuitableForBatchInsert()
Returns if the entity is suitable for batch insert, that is not of
IdType.IDENTITY. |
void |
performInsert(Connection connection,
ManagedInstance<?>[] managedInstances,
int size)
Performs inserts to each table for the managed instance.
|
void |
performRefresh(Connection connection,
ManagedInstance<X> instance,
javax.persistence.LockModeType lockMode,
Set<Object> processed)
Performs refresh for the instance
|
void |
performRemove(Connection connection,
ManagedInstance<?>[] managedInstances,
int size) |
X |
performSelect(EntityManagerImpl entityManager,
Object id,
javax.persistence.LockModeType lockMode)
Performs select to find the instance.
|
void |
performUpdate(Connection connection,
ManagedInstance<?> managedInstance)
Performs the update for the instance.
|
void |
performVersionUpdate(Connection connection,
ManagedInstance<? extends X> instance,
Object oldVersion,
Object newVersion)
Performs the version update for the instance.
|
void |
prepareDependenciesFor(EntityTypeImpl<?> associate)
Prepares the dependencies for the associate.
|
void |
prepareEagerJoins(javax.persistence.criteria.FetchParent<?,?> r,
int depth,
AssociationMappingImpl<?,?,?> parent) |
Set<javax.validation.ConstraintViolation<Object>> |
runValidators(EntityManagerFactoryImpl entityManagerFactory,
ManagedInstance<?> instance)
Runs the validators for the instance.
|
void |
setId(SessionImpl session,
Object instance,
Object id)
Sets the id of the entity from the instance.
|
String |
toString() |
addAttributes, fireCallbacks, getAvailability, getCallbackManager, getDeclaredId, getDeclaredVersion, getId, getIdClass, getIdClassAttributes, getIdType, getSupertype, getVersion, getVersionAttribute, getVersionType, hasSingleIdAttribute, hasVersionAttribute, newCompositeId, updateAvailabilitygetAttribute, getAttributes, getCollection, getCollection, getDeclaredAttribute, getDeclaredAttributes, getDeclaredCollection, getDeclaredCollection, getDeclaredList, getDeclaredList, getDeclaredMap, getDeclaredMap, getDeclaredPluralAttributes, getDeclaredSet, getDeclaredSet, getDeclaredSingularAttribute, getDeclaredSingularAttribute, getDeclaredSingularAttributes, getList, getList, getLocator, getMap, getMap, getPluralAttributes, getSet, getSet, getSingularAttribute, getSingularAttribute, getSingularAttributesgetJavaType, getMetamodelclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetDeclaredId, getDeclaredVersion, getId, getIdClassAttributes, getIdType, getSupertype, getVersion, hasSingleIdAttribute, hasVersionAttributegetAttribute, getAttributes, getCollection, getCollection, getDeclaredAttribute, getDeclaredAttributes, getDeclaredCollection, getDeclaredCollection, getDeclaredList, getDeclaredList, getDeclaredMap, getDeclaredMap, getDeclaredPluralAttributes, getDeclaredSet, getDeclaredSet, getDeclaredSingularAttribute, getDeclaredSingularAttribute, getDeclaredSingularAttributes, getList, getList, getMap, getMap, getPluralAttributes, getSet, getSet, getSingularAttribute, getSingularAttribute, getSingularAttributesgetIdClass, hasSingleIdAttributegetJavaTypepublic EntityTypeImpl(MetamodelImpl metamodel, IdentifiableTypeImpl<? super X> parent, Class<X> javaType, EntityMetadata metadata)
metamodel - the metamodelparent - the parent typejavaType - the java type of the managed typemetadata - the metadataprotected void addAttribute(AttributeImpl<? super X,?> attribute)
addAttribute in class IdentifiableTypeImpl<X>attribute - the declared attributepublic boolean canBatchRemoves()
The remove operation can be combined into a batch provided:
true if remove operation can be combined into a batch, false otherwisepublic boolean extendz(EntityTypeImpl<?> parent)
parent - the parent to testpublic void fireCallbacks(Object instance, EntityListenerMetadata.EntityListenerType type)
instance - the instancetype - the typepublic EntityTable[] getAllTables()
public AssociationMetadata getAssociationOverride(String path)
path is overridden by the entity.path - the path of the attributenullpublic AssociationMappingImpl<?,?,?>[] getAssociations()
public AssociationMappingImpl<?,?,?>[] getAssociationsDetachable()
public AssociationMappingImpl<?,?,?>[] getAssociationsJoined()
public AssociationMappingImpl<?,?,?>[] getAssociationsNotPersistable()
public AssociationMappingImpl<?,?,?>[] getAssociationsPersistable()
public PluralAssociationMappingImpl<?,?,?>[] getAssociationsPlural()
public AssociationMappingImpl<?,?,?>[] getAssociationsRemovable()
public SingularAssociationMappingImpl<?,?>[] getAssociationsSingular()
public SingularAssociationMappingImpl<?,?>[] getAssociationsSingularOwnerLazy()
public ColumnMetadata getAttributeOverride(String path)
path is overridden by the entity.path - the path of the attributenullpublic BasicMappingImpl<?,?>[] getBasicMappings()
public Class<X> getBindableJavaType()
getBindableJavaType in interface javax.persistence.metamodel.Bindable<X>public javax.persistence.metamodel.Bindable.BindableType getBindableType()
getBindableType in interface javax.persistence.metamodel.Bindable<X>public EntityTypeImpl<? extends X> getChildType(String discriminatorValue)
discriminatorValue value.discriminatorValue - the discriminator value of the childpublic AssociationMappingImpl<?,?,?>[] getDependenciesFor(EntityTypeImpl<?> associate)
associate - the associate typepublic int getDependencyCount()
public DiscriminatorColumn getDiscriminatorColumn()
public Set<String> getDiscriminators()
public String getDiscriminatorValue()
getDiscriminatorValue in interface EntityTypeDescriptorpublic ManagedId<X> getId(Object instance)
instance - the instancepublic ManagedId<X> getId(SessionImpl session, ResultSet row) throws SQLException
session - the sessionrow - the rowSQLException - if an SQL error occurrspublic ManagedId<X> getId(SessionImpl session, ResultSet row, HashMap<AbstractColumn,String> idFields) throws SQLException
session - the sessionrow - the rowidFields - the id fieldsSQLException - if an SQL error occurrspublic SingularMappingEx<? super X,?> getIdMapping()
getIdMapping in interface EntityTypeDescriptorpublic Pair<SingularMapping<?,?>,AbstractAccessor>[] getIdMappings()
getIdMappings in interface EntityTypeDescriptorpublic javax.persistence.InheritanceType getInheritanceType()
nullpublic Object getInstanceId(X instance)
instance - the instancepublic ManagedInstance<X> getManagedInstance(SessionImpl session, X instance)
instance - the instance to create managed instance forsession - the sessionNullPointerException - thrown if the instance is nullpublic ManagedInstance<X> getManagedInstanceById(SessionImpl session, ManagedId<X> id, boolean lazy)
session - the sessionid - the primary keylazy - if the instance is lazypublic Object getMappedId(String name, Object instance)
name - thename of the id fieldinstance - the instancepublic JoinedMapping<?,?,?>[] getMappingsJoined()
public PluralMappingEx<?,?,?>[] getMappingsPlural()
public PluralMappingEx<?,?,?>[] getMappingsPluralSorted()
public AbstractMapping<?,?,?>[] getMappingsSingular()
public String getName()
getName in interface javax.persistence.metamodel.EntityType<X>getName in interface EntityTypeDescriptorgetName in class ManagedTypeImpl<X>public EntityTypeImpl<? super X> getParent()
nullpublic javax.persistence.metamodel.Type.PersistenceType getPersistenceType()
getPersistenceType in interface javax.persistence.metamodel.Type<X>public EntityTable getPrimaryTable()
getPrimaryTable in interface EntityTypeDescriptorpublic EntityMapping<X> getRootMapping()
public EntityTypeImpl<? super X> getRootType()
public AbstractTable getTable(String tableName)
If the tableName is blank then the primary table is returned
getTable in interface EntityTypeDescriptortableName - the name of the table, may be blankpublic EntityTable[] getTables()
public boolean isIdMethod(Method method)
method - the methodpublic boolean isRoot()
public boolean isSuitableForBatchInsert()
IdType.IDENTITY.public void performInsert(Connection connection, ManagedInstance<?>[] managedInstances, int size) throws SQLException
connection - the connection to usemanagedInstances - the managed instances to perform insert forsize - the size of the batchSQLException - thrown in case of an SQL Errorpublic void performRefresh(Connection connection, ManagedInstance<X> instance, javax.persistence.LockModeType lockMode, Set<Object> processed)
connection - the connectioninstance - the managed instancelockMode - the lock modeprocessed - the set of processed instancespublic void performRemove(Connection connection, ManagedInstance<?>[] managedInstances, int size) throws SQLException
connection - the connection to usemanagedInstances - the managed instance to perform remove forsize - the size of the batchSQLException - thrown in case of an SQL Errorpublic X performSelect(EntityManagerImpl entityManager, Object id, javax.persistence.LockModeType lockMode)
entityManager - the entity manager to useid - the id of the instance to selectlockMode - the lock modepublic void performUpdate(Connection connection, ManagedInstance<?> managedInstance) throws SQLException
connection - the connection to usemanagedInstance - the managed instance to perform update forSQLException - thrown in case of an SQL Errorpublic void performVersionUpdate(Connection connection, ManagedInstance<? extends X> instance, Object oldVersion, Object newVersion) throws SQLException
connection - the connection to useinstance - the managed instance to perform update foroldVersion - the old version valuenewVersion - the new version valueSQLException - thrown in case of an SQL Errorpublic void prepareDependenciesFor(EntityTypeImpl<?> associate)
associate - the associatepublic void prepareEagerJoins(javax.persistence.criteria.FetchParent<?,?> r,
int depth,
AssociationMappingImpl<?,?,?> parent)
r - the fetch parentdepth - the depthparent - the parentpublic Set<javax.validation.ConstraintViolation<Object>> runValidators(EntityManagerFactoryImpl entityManagerFactory, ManagedInstance<?> instance)
entityManagerFactory - the entity manager factoryinstance - the instancepublic void setId(SessionImpl session, Object instance, Object id)
session - the sessioninstance - the instanceid - the idCopyright © 2012-2013 Batoo. All Rights Reserved.