类 SessionFactoryHelper
- java.lang.Object
-
- org.hibernate.hql.internal.ast.util.SessionFactoryHelper
-
public class SessionFactoryHelper extends Object
Helper for performing common and/or complex operations with theSessionFactoryImplementorduring translation of an HQL query.- 作者:
- Joshua Davis
-
-
构造器概要
构造器 构造器 说明 SessionFactoryHelper(SessionFactoryImplementor sfi)Construct a new SessionFactoryHelper instance.
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 JoinSequencecreateCollectionJoinSequence(QueryableCollection collPersister, String collectionName)Create a join sequence rooted at the given collection.JoinSequencecreateJoinSequence()Generate an empty join sequence instance.JoinSequencecreateJoinSequence(boolean implicit, AssociationType associationType, String tableAlias, JoinType joinType, String[] columns)Generate a join sequence representing the given association type.JoinSequencecreateJoinSequence(boolean implicit, AssociationType associationType, String tableAlias, JoinType joinType, String[][] columns)Generate a join sequence representing the given association type.EntityPersisterfindEntityPersisterByName(String name)Locate the persister by class or entity name.TypefindFunctionReturnType(String functionName, antlr.collections.AST first)Find the function return type given the function name and the first argument expression node.TypefindFunctionReturnType(String functionName, SQLFunction sqlFunction, antlr.collections.AST firstArgument)QueryablefindQueryableUsingImports(String className)Given a (potentially unqualified) class name, locate its persister.static QueryablefindQueryableUsingImports(SessionFactoryImplementor sfi, String className)Given a (potentially unqualified) class name, locate its persister.SQLFunctionfindSQLFunction(String functionName)Locate a registered sql function by name.String[][]generateColumnNames(Type[] sqlResultTypes)StringgetAssociatedEntityName(CollectionType collectionType)Given a collection type, determine the entity name of the elements contained within instance of that collection.String[]getCollectionElementColumns(String role, String roleAlias)Retrieves the column names corresponding to the collection elements for the given collection role.QueryableCollectiongetCollectionPersister(String role)Locate the collection persister by the collection role.PropertyMappinggetCollectionPropertyMapping(String role)Retrieve a PropertyMapping describing the given collection role.intgetColumnSpan(Type type)Retrieve the number of columns represented by this type.AssociationTypegetElementAssociationType(CollectionType collectionType)Essentially the same asgetElementType(org.hibernate.type.CollectionType), but requiring that the element type be an association type.SessionFactoryImplementorgetFactory()Get a handle to the encapsulated SessionFactory.StringgetIdentifierOrUniqueKeyPropertyName(EntityType entityType)Determine the name of the property for the entity encapsulated by the given type which represents the id or unique-key.StringgetImportedClassName(String className)Given a (potentially unqualified) class name, locate its imported qualified name.booleanhasPhysicalDiscriminatorColumn(Queryable persister)Does the given persister define a physical discriminator column for the purpose of inheritance discrimination?booleanisStrictJPAQLComplianceEnabled()EntityPersisterrequireClassPersister(String name)Locate the persister by class or entity name, requiring that such a persister exist.QueryableCollectionrequireQueryableCollection(String role)Locate the collection persister by the collection role, requiring that such a persister exist.
-
-
-
构造器详细资料
-
SessionFactoryHelper
public SessionFactoryHelper(SessionFactoryImplementor sfi)
Construct a new SessionFactoryHelper instance.- 参数:
sfi- The SessionFactory impl to be encapsulated.
-
-
方法详细资料
-
getFactory
public SessionFactoryImplementor getFactory()
Get a handle to the encapsulated SessionFactory.- 返回:
- The encapsulated SessionFactory.
-
hasPhysicalDiscriminatorColumn
public boolean hasPhysicalDiscriminatorColumn(Queryable persister)
Does the given persister define a physical discriminator column for the purpose of inheritance discrimination?- 参数:
persister- The persister to be checked.- 返回:
- True if the persister does define an actual discriminator column.
-
getImportedClassName
public String getImportedClassName(String className)
Given a (potentially unqualified) class name, locate its imported qualified name.- 参数:
className- The potentially unqualified class name- 返回:
- The qualified class name.
-
findQueryableUsingImports
public Queryable findQueryableUsingImports(String className)
Given a (potentially unqualified) class name, locate its persister.- 参数:
className- The (potentially unqualified) class name.- 返回:
- The defined persister for this class, or null if none found.
-
findQueryableUsingImports
public static Queryable findQueryableUsingImports(SessionFactoryImplementor sfi, String className)
Given a (potentially unqualified) class name, locate its persister.- 参数:
sfi- The session factory implementor.className- The (potentially unqualified) class name.- 返回:
- The defined persister for this class, or null if none found.
-
findEntityPersisterByName
public EntityPersister findEntityPersisterByName(String name) throws MappingException
Locate the persister by class or entity name.- 参数:
name- The class or entity name- 返回:
- The defined persister for this entity, or null if none found.
- 抛出:
MappingException
-
requireClassPersister
public EntityPersister requireClassPersister(String name) throws antlr.SemanticException
Locate the persister by class or entity name, requiring that such a persister exist.- 参数:
name- The class or entity name- 返回:
- The defined persister for this entity
- 抛出:
antlr.SemanticException- Indicates the persister could not be found
-
getCollectionPersister
public QueryableCollection getCollectionPersister(String role)
Locate the collection persister by the collection role.- 参数:
role- The collection role name.- 返回:
- The defined CollectionPersister for this collection role, or null.
-
requireQueryableCollection
public QueryableCollection requireQueryableCollection(String role) throws QueryException
Locate the collection persister by the collection role, requiring that such a persister exist.- 参数:
role- The collection role name.- 返回:
- The defined CollectionPersister for this collection role.
- 抛出:
QueryException- Indicates that the collection persister could not be found.
-
getCollectionPropertyMapping
public PropertyMapping getCollectionPropertyMapping(String role)
Retrieve a PropertyMapping describing the given collection role.- 参数:
role- The collection role for which to retrieve the property mapping.- 返回:
- The property mapping.
-
getCollectionElementColumns
public String[] getCollectionElementColumns(String role, String roleAlias)
Retrieves the column names corresponding to the collection elements for the given collection role.- 参数:
role- The collection roleroleAlias- The sql column-qualification alias (i.e., the table alias)- 返回:
- the collection element columns
-
createJoinSequence
public JoinSequence createJoinSequence()
Generate an empty join sequence instance.- 返回:
- The generate join sequence.
-
createJoinSequence
public JoinSequence createJoinSequence(boolean implicit, AssociationType associationType, String tableAlias, JoinType joinType, String[] columns)
Generate a join sequence representing the given association type.- 参数:
implicit- Should implicit joins (theta-style) or explicit joins (ANSI-style) be renderedassociationType- The type representing the thing to be joined into.tableAlias- The table alias to use in qualifying the join conditionsjoinType- The type of join to render (inner, outer, etc); seeJoinFragmentcolumns- The columns making up the condition of the join.- 返回:
- The generated join sequence.
-
createJoinSequence
public JoinSequence createJoinSequence(boolean implicit, AssociationType associationType, String tableAlias, JoinType joinType, String[][] columns)
Generate a join sequence representing the given association type.- 参数:
implicit- Should implicit joins (theta-style) or explicit joins (ANSI-style) be renderedassociationType- The type representing the thing to be joined into.tableAlias- The table alias to use in qualifying the join conditionsjoinType- The type of join to render (inner, outer, etc); seeJoinFragmentcolumns- The columns making up the condition of the join.- 返回:
- The generated join sequence.
-
createCollectionJoinSequence
public JoinSequence createCollectionJoinSequence(QueryableCollection collPersister, String collectionName)
Create a join sequence rooted at the given collection.- 参数:
collPersister- The persister for the collection at which the join should be rooted.collectionName- The alias to use for qualifying column references.- 返回:
- The generated join sequence.
-
getIdentifierOrUniqueKeyPropertyName
public String getIdentifierOrUniqueKeyPropertyName(EntityType entityType)
Determine the name of the property for the entity encapsulated by the given type which represents the id or unique-key.- 参数:
entityType- The type representing the entity.- 返回:
- The corresponding property name
- 抛出:
QueryException- Indicates such a property could not be found.
-
getColumnSpan
public int getColumnSpan(Type type)
Retrieve the number of columns represented by this type.- 参数:
type- The type.- 返回:
- The number of columns.
-
getAssociatedEntityName
public String getAssociatedEntityName(CollectionType collectionType)
Given a collection type, determine the entity name of the elements contained within instance of that collection.- 参数:
collectionType- The collection type to check.- 返回:
- The entity name of the elements of this collection.
-
getElementAssociationType
public AssociationType getElementAssociationType(CollectionType collectionType)
Essentially the same asgetElementType(org.hibernate.type.CollectionType), but requiring that the element type be an association type.- 参数:
collectionType- The collection type to be checked.- 返回:
- The AssociationType of the elements of the collection.
-
findSQLFunction
public SQLFunction findSQLFunction(String functionName)
Locate a registered sql function by name.- 参数:
functionName- The name of the function to locate- 返回:
- The sql function, or null if not found.
-
findFunctionReturnType
public Type findFunctionReturnType(String functionName, antlr.collections.AST first)
Find the function return type given the function name and the first argument expression node.- 参数:
functionName- The function name.first- The first argument expression.- 返回:
- the function return type given the function name and the first argument expression node.
-
findFunctionReturnType
public Type findFunctionReturnType(String functionName, SQLFunction sqlFunction, antlr.collections.AST firstArgument)
-
isStrictJPAQLComplianceEnabled
public boolean isStrictJPAQLComplianceEnabled()
-
-