org.hibernate.Query.getReturnAliases()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(223)

本文整理了Java中org.hibernate.Query.getReturnAliases方法的一些代码示例,展示了Query.getReturnAliases的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getReturnAliases方法的具体详情如下:
包路径:org.hibernate.Query
类名称:Query
方法名:getReturnAliases

Query.getReturnAliases介绍

暂无

代码示例

代码示例来源:origin: hibernate/hibernate-orm

public TupleBuilderTransformer(org.hibernate.Query hqlQuery) {
  final Type[] resultTypes = hqlQuery.getReturnTypes();
  final int tupleSize = resultTypes.length;
  this.tupleElements = CollectionHelper.arrayList( tupleSize );
  final String[] aliases = hqlQuery.getReturnAliases();
  final boolean hasAliases = aliases != null && aliases.length > 0;
  this.tupleElementsByAlias = hasAliases
      ? CollectionHelper.<String, HqlTupleElementImpl>mapOfSize( tupleSize )
      : Collections.<String, HqlTupleElementImpl>emptyMap();
  for ( int i = 0; i < tupleSize; i++ ) {
    final HqlTupleElementImpl tupleElement = new HqlTupleElementImpl(
        i,
        aliases == null ? null : aliases[i],
        resultTypes[i]
    );
    tupleElements.add( tupleElement );
    if ( hasAliases ) {
      final String alias = aliases[i];
      if ( alias != null ) {
        tupleElementsByAlias.put( alias, tupleElement );
      }
    }
  }
}

代码示例来源:origin: hibernate/hibernate-orm

@Test
@TestForIssue( jiraKey = "HHH-1464" )
public void testQueryMetadataRetrievalWithFetching() {
  // HHH-1464 : there was a problem due to the fact they we polled
  // the shallow version of the query plan to get the metadata.
  Session s = openSession();
  Query query = s.createQuery( "from Animal a inner join fetch a.mother" );
  assertEquals( 1, query.getReturnTypes().length );
  assertNull( query.getReturnAliases() );
  s.close();
}

代码示例来源:origin: jasperreports/jasperreports

/**
 * Returns the aliases of the HQL query.
 * 
 * @return the aliases of the HQL query
 */
public String[] getReturnAliases()
{
  return query.getReturnAliases();
}

代码示例来源:origin: com.github.cafdataprocessing/corepolicy-hibernate

@Override
public String[] getReturnAliases() {
  return query.getReturnAliases();
}

代码示例来源:origin: ezbz/projectx

@Override
public String[] getReturnAliases() throws HibernateException {
 return query.getReturnAliases();
}

代码示例来源:origin: riotfamily/riot

public String[] getReturnAliases() throws HibernateException {
  return query.getReturnAliases();
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.ejb

public TupleBuilderTransformer(org.hibernate.Query hqlQuery) {
  final Type[] resultTypes = hqlQuery.getReturnTypes();
  final int tupleSize = resultTypes.length;
  this.tupleElements = CollectionHelper.arrayList( tupleSize );
  final String[] aliases = hqlQuery.getReturnAliases();
  final boolean hasAliases = aliases != null && aliases.length > 0;
  this.tupleElementsByAlias = hasAliases
      ? CollectionHelper.<String, HqlTupleElementImpl>mapOfSize( tupleSize )
      : Collections.<String, HqlTupleElementImpl>emptyMap();
  for ( int i = 0; i < tupleSize; i++ ) {
    final HqlTupleElementImpl tupleElement = new HqlTupleElementImpl(
        i,
        aliases == null ? null : aliases[i],
        resultTypes[i]
    );
    tupleElements.add( tupleElement );
    if ( hasAliases ) {
      final String alias = aliases[i];
      if ( alias != null ) {
        tupleElementsByAlias.put( alias, tupleElement );
      }
    }
  }
}

相关文章