Methods Summary |
---|
public org.hibernate.engine.JoinSequence | createCollectionJoinSequence(org.hibernate.persister.collection.QueryableCollection collPersister, java.lang.String collectionName)Create a join sequence rooted at the given collection.
JoinSequence joinSequence = createJoinSequence();
joinSequence.setRoot( collPersister, collectionName );
joinSequence.setUseThetaStyle( true ); // TODO: figure out how this should be set.
///////////////////////////////////////////////////////////////////////////////
// This was the reason for failures regarding INDEX_OP and subclass joins on
// theta-join dialects; not sure what behaviour we were trying to emulate ;)
// joinSequence = joinSequence.getFromPart(); // Emulate the old addFromOnly behavior.
return joinSequence;
|
public org.hibernate.engine.JoinSequence | createJoinSequence()Generate an empty join sequence instance.
return new JoinSequence( sfi );
|
public org.hibernate.engine.JoinSequence | createJoinSequence(boolean implicit, org.hibernate.type.AssociationType associationType, java.lang.String tableAlias, int joinType, java.lang.String[] columns)Generate a join sequence representing the given association type.
JoinSequence joinSequence = createJoinSequence();
joinSequence.setUseThetaStyle( implicit ); // Implicit joins use theta style (WHERE pk = fk), explicit joins use JOIN (after from)
joinSequence.addJoin( associationType, tableAlias, joinType, columns );
return joinSequence;
|
private org.hibernate.persister.entity.EntityPersister | findEntityPersisterByName(java.lang.String name)Locate the persister by class or entity name.
// First, try to get the persister using the given name directly.
try {
return sfi.getEntityPersister( name );
}
catch ( MappingException ignore ) {
// unable to locate it using this name
}
// If that didn't work, try using the 'import' name.
String importedClassName = sfi.getImportedClassName( name );
if ( importedClassName == null ) {
return null;
}
return sfi.getEntityPersister( importedClassName );
|
public org.hibernate.type.Type | findFunctionReturnType(java.lang.String functionName, antlr.collections.AST first)Find the function return type given the function name and the first argument expression node.
// locate the registered function by the given name
SQLFunction sqlFunction = requireSQLFunction( functionName );
// determine the type of the first argument...
Type argumentType = null;
if ( first != null ) {
if ( "cast".equals(functionName) ) {
argumentType = TypeFactory.heuristicType( first.getNextSibling().getText() );
}
else if ( first instanceof SqlNode ) {
argumentType = ( (SqlNode) first ).getDataType();
}
}
return sqlFunction.getReturnType( argumentType, sfi );
|
public org.hibernate.persister.entity.Queryable | findQueryableUsingImports(java.lang.String className)Given a (potentially unqualified) class name, locate its persister.
return findQueryableUsingImports( sfi, className );
|
public static org.hibernate.persister.entity.Queryable | findQueryableUsingImports(org.hibernate.engine.SessionFactoryImplementor sfi, java.lang.String className)Given a (potentially unqualified) class name, locate its persister.
final String importedClassName = sfi.getImportedClassName( className );
if ( importedClassName == null ) {
return null;
}
try {
return ( Queryable ) sfi.getEntityPersister( importedClassName );
}
catch ( MappingException me ) {
return null;
}
|
public org.hibernate.dialect.function.SQLFunction | findSQLFunction(java.lang.String functionName)Locate a registered sql function by name.
return sfi.getSqlFunctionRegistry().findSQLFunction( functionName.toLowerCase() );
|
public java.lang.String[][] | generateColumnNames(org.hibernate.type.Type[] sqlResultTypes)
return NameGenerator.generateColumnNames( sqlResultTypes, sfi );
|
public java.lang.String | getAssociatedEntityName(org.hibernate.type.CollectionType collectionType)Given a collection type, determine the entity name of the elements
contained within instance of that collection.
return collectionType.getAssociatedEntityName( sfi );
|
public java.lang.String[] | getCollectionElementColumns(java.lang.String role, java.lang.String roleAlias)Retrieves the column names corresponding to the collection elements for the given
collection role.
return getCollectionPropertyMapping( role ).toColumns( roleAlias, CollectionPropertyNames.COLLECTION_ELEMENTS );
|
public org.hibernate.persister.collection.QueryableCollection | getCollectionPersister(java.lang.String role)Locate the collection persister by the collection role.
try {
return ( QueryableCollection ) sfi.getCollectionPersister( role );
}
catch ( ClassCastException cce ) {
throw new QueryException( "collection is not queryable: " + role );
}
catch ( Exception e ) {
throw new QueryException( "collection not found: " + role );
}
|
private org.hibernate.persister.entity.PropertyMapping | getCollectionPropertyMapping(java.lang.String role)Retreive a PropertyMapping describing the given collection role.
return ( PropertyMapping ) collectionPropertyMappingByRole.get( role );
|
public int | getColumnSpan(org.hibernate.type.Type type)Retreive the number of columns represented by this type.
return type.getColumnSpan( sfi );
|
public org.hibernate.type.AssociationType | getElementAssociationType(org.hibernate.type.CollectionType collectionType)Essentially the same as {@link #getElementType}, but requiring that the
element type be an association type.
return ( AssociationType ) getElementType( collectionType );
|
private org.hibernate.type.Type | getElementType(org.hibernate.type.CollectionType collectionType)Given a collection type, determine the Type representing elements
within instances of that collection.
return collectionType.getElementType( sfi );
|
public org.hibernate.engine.SessionFactoryImplementor | getFactory()Get a handle to the encapsulated SessionFactory.
return sfi;
|
public java.lang.String | getIdentifierOrUniqueKeyPropertyName(org.hibernate.type.EntityType entityType)Determine the name of the property for the entity encapsulated by the
given type which represents the id or unique-key.
try {
return entityType.getIdentifierOrUniqueKeyPropertyName( sfi );
}
catch ( MappingException me ) {
throw new QueryException( me );
}
|
public java.lang.String | getImportedClassName(java.lang.String className)Given a (potentially unqualified) class name, locate its imported qualified name.
return sfi.getImportedClassName( className );
|
public boolean | hasPhysicalDiscriminatorColumn(org.hibernate.persister.entity.Queryable persister)Does the given persister define a physical discriminator column
for the purpose of inheritence discrimination?
if ( persister.getDiscriminatorType() != null ) {
String discrimColumnName = persister.getDiscriminatorColumnName();
// Needed the "clazz_" check to work around union-subclasses
// TODO : is there a way to tell whether a persister is truly discrim-column based inheritence?
if ( discrimColumnName != null && !"clazz_".equals( discrimColumnName ) ) {
return true;
}
}
return false;
|
public boolean | isStrictJPAQLComplianceEnabled()
return sfi.getSettings().isStrictJPAQLCompliance();
|
public org.hibernate.persister.entity.EntityPersister | requireClassPersister(java.lang.String name)Locate the persister by class or entity name, requiring that such a persister
exist.
EntityPersister cp;
try {
cp = findEntityPersisterByName( name );
if ( cp == null ) {
throw new QuerySyntaxException( name + " is not mapped" );
}
}
catch ( MappingException e ) {
throw new DetailedSemanticException( e.getMessage(), e );
}
return cp;
|
public org.hibernate.persister.collection.QueryableCollection | requireQueryableCollection(java.lang.String role)Locate the collection persister by the collection role, requiring that
such a persister exist.
try {
QueryableCollection queryableCollection = ( QueryableCollection ) sfi.getCollectionPersister( role );
if ( queryableCollection != null ) {
collectionPropertyMappingByRole.put( role, new CollectionPropertyMapping( queryableCollection ) );
}
return queryableCollection;
}
catch ( ClassCastException cce ) {
throw new QueryException( "collection role is not queryable: " + role );
}
catch ( Exception e ) {
throw new QueryException( "collection role not found: " + role );
}
|
private org.hibernate.dialect.function.SQLFunction | requireSQLFunction(java.lang.String functionName)Locate a registered sql function by name, requiring that such a registered function exist.
SQLFunction f = findSQLFunction( functionName );
if ( f == null ) {
throw new QueryException( "Unable to find SQL function: " + functionName );
}
return f;
|