本文整理汇总了Java中org.hibernate.type.AssociationType.getAssociatedJoinable方法的典型用法代码示例。如果您正苦于以下问题:Java AssociationType.getAssociatedJoinable方法的具体用法?Java AssociationType.getAssociatedJoinable怎么用?Java AssociationType.getAssociatedJoinable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.type.AssociationType
的用法示例。
在下文中一共展示了AssociationType.getAssociatedJoinable方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: OuterJoinableAssociation
import org.hibernate.type.AssociationType; //导入方法依赖的package包/类
public OuterJoinableAssociation(
PropertyPath propertyPath,
AssociationType joinableType,
String lhsAlias,
String[] lhsColumns,
String rhsAlias,
JoinType joinType,
String withClause,
boolean hasRestriction,
SessionFactoryImplementor factory,
Map enabledFilters) throws MappingException {
this.propertyPath = propertyPath;
this.joinableType = joinableType;
this.lhsAlias = lhsAlias;
this.lhsColumns = lhsColumns;
this.rhsAlias = rhsAlias;
this.joinType = joinType;
this.joinable = joinableType.getAssociatedJoinable(factory);
this.rhsColumns = JoinHelper.getRHSColumnNames(joinableType, factory);
this.on = joinableType.getOnCondition(rhsAlias, factory, enabledFilters)
+ ( withClause == null || withClause.trim().length() == 0 ? "" : " and ( " + withClause + " )" );
this.hasRestriction = hasRestriction;
this.enabledFilters = enabledFilters; // needed later for many-to-many/filter application
}
示例2: OuterJoinableAssociation
import org.hibernate.type.AssociationType; //导入方法依赖的package包/类
public OuterJoinableAssociation(
AssociationType joinableType,
String lhsAlias,
String[] lhsColumns,
String rhsAlias,
int joinType,
SessionFactoryImplementor factory,
Map enabledFilters)
throws MappingException {
this.joinableType = joinableType;
this.lhsAlias = lhsAlias;
this.lhsColumns = lhsColumns;
this.rhsAlias = rhsAlias;
this.joinType = joinType;
this.joinable = joinableType.getAssociatedJoinable(factory);
this.rhsColumns = JoinHelper.getRHSColumnNames(joinableType, factory);
this.on = joinableType.getOnCondition(rhsAlias, factory, enabledFilters);
this.enabledFilters = enabledFilters; // needed later for many-to-many/filter application
}
示例3: isSubsequentSelectDelayed
import org.hibernate.type.AssociationType; //导入方法依赖的package包/类
private static boolean isSubsequentSelectDelayed(AssociationType type, SessionFactoryImplementor sessionFactory) {
if ( type.isAnyType() ) {
// we'd need more context here. this is only kept as part of the property state on the owning entity
return false;
}
else if ( type.isEntityType() ) {
return ( (EntityPersister) type.getAssociatedJoinable( sessionFactory ) ).hasProxy();
}
else {
final CollectionPersister cp = ( (CollectionPersister) type.getAssociatedJoinable( sessionFactory ) );
return cp.isLazy() || cp.isExtraLazy();
}
}
示例4: getAssociationKey
import org.hibernate.type.AssociationType; //导入方法依赖的package包/类
@Override
public AssociationKey getAssociationKey() {
final AssociationType type = getType();
if ( type.isAnyType() ) {
return new AssociationKey(
JoinHelper.getLHSTableName( type, attributeNumber(), (OuterJoinLoadable) getSource() ),
JoinHelper.getLHSColumnNames(
type,
attributeNumber(),
0,
(OuterJoinLoadable) getSource(),
sessionFactory()
)
);
}
final Joinable joinable = type.getAssociatedJoinable( sessionFactory() );
if ( type.getForeignKeyDirection() == ForeignKeyDirection.FOREIGN_KEY_FROM_PARENT ) {
final String lhsTableName;
final String[] lhsColumnNames;
if ( joinable.isCollection() ) {
final QueryableCollection collectionPersister = (QueryableCollection) joinable;
lhsTableName = collectionPersister.getTableName();
lhsColumnNames = collectionPersister.getElementColumnNames();
}
else {
final OuterJoinLoadable entityPersister = (OuterJoinLoadable) source();
lhsTableName = getLHSTableName( type, attributeNumber(), entityPersister );
lhsColumnNames = getLHSColumnNames( type, attributeNumber(), entityPersister, sessionFactory() );
}
return new AssociationKey( lhsTableName, lhsColumnNames );
}
else {
return new AssociationKey( joinable.getTableName(), getRHSColumnNames( type, sessionFactory() ) );
}
}
示例5: getRHSColumnNames
import org.hibernate.type.AssociationType; //导入方法依赖的package包/类
/**
* Get the columns of the associated table which are to be used in the join
*
* @param type The type
* @param factory The SessionFactory
*
* @return The columns for the right-hand-side of the join
*/
public static String[] getRHSColumnNames(AssociationType type, SessionFactoryImplementor factory) {
final String uniqueKeyPropertyName = type.getRHSUniqueKeyPropertyName();
final Joinable joinable = type.getAssociatedJoinable( factory );
if ( uniqueKeyPropertyName == null ) {
return joinable.getKeyColumnNames();
}
else {
return ( (OuterJoinLoadable) joinable ).getPropertyColumnNames( uniqueKeyPropertyName );
}
}
示例6: Join
import org.hibernate.type.AssociationType; //导入方法依赖的package包/类
Join(
SessionFactoryImplementor factory,
AssociationType associationType,
String alias,
JoinType joinType,
String[] lhsColumns) throws MappingException {
this.associationType = associationType;
this.joinable = associationType.getAssociatedJoinable( factory );
this.alias = alias;
this.joinType = joinType;
this.lhsColumns = lhsColumns;
}
示例7: getRHSColumnNames
import org.hibernate.type.AssociationType; //导入方法依赖的package包/类
/**
* Get the columns of the associated table which are to
* be used in the join
*/
public static String[] getRHSColumnNames(AssociationType type, SessionFactoryImplementor factory) {
String uniqueKeyPropertyName = type.getRHSUniqueKeyPropertyName();
Joinable joinable = type.getAssociatedJoinable(factory);
if (uniqueKeyPropertyName==null) {
return joinable.getKeyColumnNames();
}
else {
return ( (OuterJoinLoadable) joinable ).getPropertyColumnNames(uniqueKeyPropertyName);
}
}
示例8: Join
import org.hibernate.type.AssociationType; //导入方法依赖的package包/类
Join(AssociationType associationType, String alias, int joinType, String[] lhsColumns)
throws MappingException {
this.associationType = associationType;
this.joinable = associationType.getAssociatedJoinable( factory );
this.alias = alias;
this.joinType = joinType;
this.lhsColumns = lhsColumns;
}
示例9: addAssociationToJoinTree
import org.hibernate.type.AssociationType; //导入方法依赖的package包/类
/**
* Add on association (one-to-one, many-to-one, or a collection) to a list
* of associations to be fetched by outerjoin
*/
private void addAssociationToJoinTree(
final AssociationType type,
final String[] aliasedLhsColumns,
final String alias,
final PropertyPath path,
final int currentDepth,
final JoinType joinType) throws MappingException {
Joinable joinable = type.getAssociatedJoinable( getFactory() );
// important to generate alias based on size of association collection
// *before* adding this join to that collection
String subalias = generateTableAlias( associations.size() + 1, path, joinable );
// NOTE : it should be fine to continue to pass only filters below
// (instead of LoadQueryInfluencers) since "from that point on" we
// only need to worry about restrictions (and not say adding more
// joins)
OuterJoinableAssociation assoc = new OuterJoinableAssociation(
path,
type,
alias,
aliasedLhsColumns,
subalias,
joinType,
getWithClause(path),
hasRestriction( path ),
getFactory(),
loadQueryInfluencers.getEnabledFilters()
);
assoc.validateJoin( path.getFullPath() );
associations.add( assoc );
int nextDepth = currentDepth + 1;
// path = "";
if ( !joinable.isCollection() ) {
if (joinable instanceof OuterJoinLoadable) {
walkEntityTree(
(OuterJoinLoadable) joinable,
subalias,
path,
nextDepth
);
}
}
else {
if (joinable instanceof QueryableCollection) {
walkCollectionTree(
(QueryableCollection) joinable,
subalias,
path,
nextDepth
);
}
}
}
示例10: getPropertyIdentifier
import org.hibernate.type.AssociationType; //导入方法依赖的package包/类
/**
* Returns the {@link PropertyIdentifier} for the given property path.
*
* In passing, it creates all the necessary aliases for embedded/associations.
*
* @param entityType the type of the entity
* @param propertyPath the path to the property without aliases
* @return the {@link PropertyIdentifier}
*/
public PropertyIdentifier getPropertyIdentifier(String entityType, List<String> propertyPath) {
// we analyze the property path to find all the associations/embedded which are in the way and create proper
// aliases for them
String entityAlias = findAliasForType( entityType );
String propertyEntityType = entityType;
String propertyAlias = entityAlias;
String propertyName;
List<String> currentPropertyPath = new ArrayList<>();
List<String> lastAssociationPath = Collections.emptyList();
OgmEntityPersister currentPersister = getPersister( entityType );
int requiredDepth = propertyPath.size();
boolean isLastElementAssociation = false;
int depth = 1;
for ( String property : propertyPath ) {
currentPropertyPath.add( property );
Type currentPropertyType = getPropertyType( entityType, currentPropertyPath );
// determine if the current property path is still part of requiredPropertyMatch
boolean optionalMatch = depth > requiredDepth;
if ( currentPropertyType.isAssociationType() ) {
AssociationType associationPropertyType = (AssociationType) currentPropertyType;
Joinable associatedJoinable = associationPropertyType.getAssociatedJoinable( getSessionFactory() );
if ( associatedJoinable.isCollection()
&& ( (OgmCollectionPersister) associatedJoinable ).getType().isComponentType() ) {
// we have a collection of embedded
throw new NotYetImplementedException();
// propertyAlias = aliasResolver.createAliasForEmbedded( entityAlias, currentPropertyPath, optionalMatch );
}
else {
propertyEntityType = associationPropertyType.getAssociatedEntityName( getSessionFactory() );
currentPersister = getPersister( propertyEntityType );
String targetNodeType = currentPersister.getEntityKeyMetadata().getTable();
throw new NotYetImplementedException();
// propertyAlias = aliasResolver.createAliasForAssociation( entityAlias, currentPropertyPath, targetNodeType, optionalMatch );
// lastAssociationPath = new ArrayList<>( currentPropertyPath );
// isLastElementAssociation = true;
}
}
else if ( currentPropertyType.isComponentType()
&& !isIdProperty( currentPersister, propertyPath.subList( lastAssociationPath.size(), propertyPath.size() ) ) ) {
// we are in the embedded case and the embedded is not the id of the entity (the id is stored as normal
// properties)
throw new NotYetImplementedException();
// propertyAlias = aliasResolver.createAliasForEmbedded( entityAlias, currentPropertyPath, optionalMatch );
}
else {
isLastElementAssociation = false;
}
depth++;
}
if ( isLastElementAssociation ) {
// even the last element is an association, we need to find a suitable identifier property
propertyName = getSessionFactory().getEntityPersister( propertyEntityType ).getIdentifierPropertyName();
}
else {
// the last element is a property so we can build the test with this property
propertyName = getColumnName( propertyEntityType, propertyPath.subList( lastAssociationPath.size(), propertyPath.size() ) );
}
return new PropertyIdentifier( propertyAlias, propertyName );
}
示例11: addAssociationToJoinTree
import org.hibernate.type.AssociationType; //导入方法依赖的package包/类
/**
* Add on association (one-to-one, many-to-one, or a collection) to a list
* of associations to be fetched by outerjoin
*/
private void addAssociationToJoinTree(
final AssociationType type,
final String[] aliasedLhsColumns,
final String alias,
final String path,
final int currentDepth,
final int joinType)
throws MappingException {
Joinable joinable = type.getAssociatedJoinable( getFactory() );
String subalias = generateTableAlias(
associations.size()+1, //before adding to collection!
path,
joinable
);
OuterJoinableAssociation assoc = new OuterJoinableAssociation(
type,
alias,
aliasedLhsColumns,
subalias,
joinType,
getFactory(),
enabledFilters
);
assoc.validateJoin(path);
associations.add(assoc);
int nextDepth = currentDepth+1;
if ( !joinable.isCollection() ) {
if (joinable instanceof OuterJoinLoadable) {
walkEntityTree(
(OuterJoinLoadable) joinable,
subalias,
path,
nextDepth
);
}
}
else {
if (joinable instanceof QueryableCollection) {
walkCollectionTree(
(QueryableCollection) joinable,
subalias,
path,
nextDepth
);
}
}
}