JoinHelperpublic final class JoinHelper extends Object
Constructors Summary |
---|
private JoinHelper()
|
Methods Summary |
---|
public static java.lang.String[] | getAliasedLHSColumnNames(org.hibernate.type.AssociationType type, java.lang.String alias, int property, org.hibernate.persister.entity.OuterJoinLoadable lhsPersister, Mapping mapping)Get the aliased columns of the owning entity which are to
be used in the join
return getAliasedLHSColumnNames(type, alias, property, 0, lhsPersister, mapping);
| public static java.lang.String[] | getAliasedLHSColumnNames(org.hibernate.type.AssociationType type, java.lang.String alias, int property, int begin, org.hibernate.persister.entity.OuterJoinLoadable lhsPersister, Mapping mapping)Get the aliased columns of the owning entity which are to
be used in the join
if ( type.useLHSPrimaryKey() ) {
return StringHelper.qualify( alias, lhsPersister.getIdentifierColumnNames() );
}
else {
String propertyName = type.getLHSPropertyName();
if (propertyName==null) {
return ArrayHelper.slice(
lhsPersister.toColumns(alias, property),
begin,
type.getColumnSpan(mapping)
);
}
else {
return ( (PropertyMapping) lhsPersister ).toColumns(alias, propertyName); //bad cast
}
}
| public static java.lang.String[] | getLHSColumnNames(org.hibernate.type.AssociationType type, int property, org.hibernate.persister.entity.OuterJoinLoadable lhsPersister, Mapping mapping)Get the columns of the owning entity which are to
be used in the join
return getLHSColumnNames(type, property, 0, lhsPersister, mapping);
| public static java.lang.String[] | getLHSColumnNames(org.hibernate.type.AssociationType type, int property, int begin, org.hibernate.persister.entity.OuterJoinLoadable lhsPersister, Mapping mapping)Get the columns of the owning entity which are to
be used in the join
if ( type.useLHSPrimaryKey() ) {
//return lhsPersister.getSubclassPropertyColumnNames(property);
return lhsPersister.getIdentifierColumnNames();
}
else {
String propertyName = type.getLHSPropertyName();
if (propertyName==null) {
//slice, to get the columns for this component
//property
return ArrayHelper.slice(
lhsPersister.getSubclassPropertyColumnNames(property),
begin,
type.getColumnSpan(mapping)
);
}
else {
//property-refs for associations defined on a
//component are not supported, so no need to slice
return lhsPersister.getPropertyColumnNames(propertyName);
}
}
| public static java.lang.String | getLHSTableName(org.hibernate.type.AssociationType type, int property, org.hibernate.persister.entity.OuterJoinLoadable lhsPersister)
if ( type.useLHSPrimaryKey() ) {
return lhsPersister.getTableName();
}
else {
String propertyName = type.getLHSPropertyName();
if (propertyName==null) {
//if there is no property-ref, assume the join
//is to the subclass table (ie. the table of the
//subclass that the association belongs to)
return lhsPersister.getSubclassPropertyTableName(property);
}
else {
//handle a property-ref
String propertyRefTable = lhsPersister.getPropertyTableName(propertyName);
if (propertyRefTable==null) {
//it is possible that the tree-walking in OuterJoinLoader can get to
//an association defined by a subclass, in which case the property-ref
//might refer to a property defined on a subclass of the current class
//in this case, the table name is not known - this temporary solution
//assumes that the property-ref refers to a property of the subclass
//table that the association belongs to (a reasonable guess)
//TODO: fix this, add: OuterJoinLoadable.getSubclassPropertyTableName(String propertyName)
propertyRefTable = lhsPersister.getSubclassPropertyTableName(property);
}
return propertyRefTable;
}
}
| public static java.lang.String[] | getRHSColumnNames(org.hibernate.type.AssociationType type, SessionFactoryImplementor factory)Get the columns of the associated table which are to
be used in the join
String uniqueKeyPropertyName = type.getRHSUniqueKeyPropertyName();
Joinable joinable = type.getAssociatedJoinable(factory);
if (uniqueKeyPropertyName==null) {
return joinable.getKeyColumnNames();
}
else {
return ( (OuterJoinLoadable) joinable ).getPropertyColumnNames(uniqueKeyPropertyName);
}
|
|