本文整理汇总了Java中org.hibernate.persister.entity.Joinable.consumesEntityAlias方法的典型用法代码示例。如果您正苦于以下问题:Java Joinable.consumesEntityAlias方法的具体用法?Java Joinable.consumesEntityAlias怎么用?Java Joinable.consumesEntityAlias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.persister.entity.Joinable
的用法示例。
在下文中一共展示了Joinable.consumesEntityAlias方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: selectString
import org.hibernate.persister.entity.Joinable; //导入方法依赖的package包/类
/**
* Generate a select list of columns containing all properties of the entity classes
*/
protected final String selectString(List associations)
throws MappingException {
if ( associations.size()==0 ) {
return "";
}
else {
StringBuilder buf = new StringBuilder( associations.size() * 100 );
int entityAliasCount=0;
int collectionAliasCount=0;
for ( int i=0; i<associations.size(); i++ ) {
OuterJoinableAssociation join = (OuterJoinableAssociation) associations.get(i);
OuterJoinableAssociation next = (i == associations.size() - 1)
? null
: ( OuterJoinableAssociation ) associations.get( i + 1 );
final Joinable joinable = join.getJoinable();
final String entitySuffix = ( suffixes == null || entityAliasCount >= suffixes.length )
? null
: suffixes[entityAliasCount];
final String collectionSuffix = ( collectionSuffixes == null || collectionAliasCount >= collectionSuffixes.length )
? null
: collectionSuffixes[collectionAliasCount];
final String selectFragment = joinable.selectFragment(
next == null ? null : next.getJoinable(),
next == null ? null : next.getRHSAlias(),
join.getRHSAlias(),
entitySuffix,
collectionSuffix,
join.getJoinType()==JoinType.LEFT_OUTER_JOIN
);
if (selectFragment.trim().length() > 0) {
buf.append(", ").append(selectFragment);
}
if ( joinable.consumesEntityAlias() ) entityAliasCount++;
if ( joinable.consumesCollectionAlias() && join.getJoinType()==JoinType.LEFT_OUTER_JOIN ) collectionAliasCount++;
}
return buf.toString();
}
}
示例2: generateTableAlias
import org.hibernate.persister.entity.Joinable; //导入方法依赖的package包/类
protected String generateTableAlias(int n, String path, Joinable joinable) {
if ( joinable.consumesEntityAlias() ) {
final Criteria subcriteria = translator.getCriteria(path);
String sqlAlias = subcriteria==null ? null : translator.getSQLAlias(subcriteria);
if (sqlAlias!=null) {
userAliasList.add( subcriteria.getAlias() ); //alias may be null
return sqlAlias; //EARLY EXIT
}
else {
userAliasList.add(null);
}
}
return super.generateTableAlias( n + translator.getSQLAliasCount(), path, joinable );
}
示例3: generateTableAlias
import org.hibernate.persister.entity.Joinable; //导入方法依赖的package包/类
@Override
protected String generateTableAlias(int n, PropertyPath path, Joinable joinable) {
// TODO: deal with side-effects (changes to includeInResultRowList, userAliasList, resultTypeList)!!!
// for collection-of-entity, we are called twice for given "path"
// once for the collection Joinable, once for the entity Joinable.
// the second call will/must "consume" the alias + perform side effects according to consumesEntityAlias()
// for collection-of-other, however, there is only one call
// it must "consume" the alias + perform side effects, despite what consumeEntityAlias() return says
//
// note: the logic for adding to the userAliasList is still strictly based on consumesEntityAlias return value
boolean checkForSqlAlias = joinable.consumesEntityAlias();
if ( !checkForSqlAlias && joinable.isCollection() ) {
// is it a collection-of-other (component or value) ?
CollectionPersister collectionPersister = (CollectionPersister)joinable;
Type elementType = collectionPersister.getElementType();
if ( elementType.isComponentType() || !elementType.isEntityType() ) {
checkForSqlAlias = true;
}
}
String sqlAlias = null;
if ( checkForSqlAlias ) {
final Criteria subcriteria = translator.getCriteria( path.getFullPath() );
sqlAlias = subcriteria==null ? null : translator.getSQLAlias(subcriteria);
if (joinable.consumesEntityAlias() && ! translator.hasProjection()) {
includeInResultRowList.add( subcriteria != null && subcriteria.getAlias() != null );
if (sqlAlias!=null) {
if ( subcriteria.getAlias() != null ) {
userAliasList.add( subcriteria.getAlias() );
resultTypeList.add( translator.getResultType( subcriteria ) );
}
}
}
}
if (sqlAlias == null) {
sqlAlias = super.generateTableAlias( n + translator.getSQLAliasCount(), path, joinable );
}
return sqlAlias;
}
示例4: selectString
import org.hibernate.persister.entity.Joinable; //导入方法依赖的package包/类
/**
* Generate a select list of columns containing all properties of the entity classes
*/
protected final String selectString(List associations)
throws MappingException {
if ( associations.size()==0 ) {
return "";
}
else {
StringBuffer buf = new StringBuffer( associations.size() * 100 )
.append(", ");
int entityAliasCount=0;
int collectionAliasCount=0;
for ( int i=0; i<associations.size(); i++ ) {
OuterJoinableAssociation join = (OuterJoinableAssociation) associations.get(i);
OuterJoinableAssociation next = (i == associations.size() - 1)
? null
: ( OuterJoinableAssociation ) associations.get( i + 1 );
final Joinable joinable = join.getJoinable();
final String entitySuffix = ( suffixes == null || entityAliasCount >= suffixes.length )
? null
: suffixes[entityAliasCount];
final String collectionSuffix = ( collectionSuffixes == null || collectionAliasCount >= collectionSuffixes.length )
? null
: collectionSuffixes[collectionAliasCount];
final String selectFragment = joinable.selectFragment(
next == null ? null : next.getJoinable(),
next == null ? null : next.getRHSAlias(),
join.getRHSAlias(),
entitySuffix,
collectionSuffix,
join.getJoinType()==JoinFragment.LEFT_OUTER_JOIN
);
buf.append(selectFragment);
if ( joinable.consumesEntityAlias() ) entityAliasCount++;
if ( joinable.consumesCollectionAlias() && join.getJoinType()==JoinFragment.LEFT_OUTER_JOIN ) collectionAliasCount++;
if (
i<associations.size()-1 &&
selectFragment.trim().length()>0
) {
buf.append(", ");
}
}
return buf.toString();
}
}