org.apache.polygene.api.query.Query.firstResult()方法的使用及代码示例

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

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

Query.firstResult介绍

[英]Set the index of the first result. Default is 0 (zero).
[中]设置第一个结果的索引。默认值为0(零)。

代码示例

代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Test
public void script17()
{
  Nameable nameable = templateFor( Nameable.class );
  Predicate<Composite> predicate = queries.get( "script17" );
  final Query<Nameable> query = unitOfWork.newQuery( this.moduleInstance
    .newQueryBuilder( Nameable.class )
    .where( predicate ) );
  query.orderBy( orderBy( nameable.name() ) );
  query.firstResult( 3 );
  query.maxResults( 3 );
  System.out.println( "*** script17: " + query );
  verifyOrderedResults( query, "Felix", "Gaming", "Jack Doe" );
}

代码示例来源:origin: apache/attic-polygene-java

@Test
public void script17()
{
  Nameable nameable = templateFor( Nameable.class );
  Predicate<Composite> predicate = queries.get( "script17" );
  final Query<Nameable> query = unitOfWork.newQuery( this.moduleInstance
    .newQueryBuilder( Nameable.class )
    .where( predicate ) );
  query.orderBy( orderBy( nameable.name() ) );
  query.firstResult( 3 );
  query.maxResults( 3 );
  System.out.println( "*** script17: " + query );
  verifyOrderedResults( query, "Felix", "Gaming", "Jack Doe" );
}

代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Test
public void script17()
{
  QueryBuilder<Nameable> qb = this.moduleInstance.newQueryBuilder( Nameable.class );
  // should return only 3 entities starting with forth one
  Nameable nameable = templateFor( Nameable.class );
  Query<Nameable> query = unitOfWork.newQuery( qb );
  query.orderBy( orderBy( nameable.name() ) );
  query.firstResult( 3 );
  query.maxResults( 2 );
  System.out.println( "*** script17: " + query );
  verifyOrderedResults( query, "Felix", "Gaming" );
}

代码示例来源:origin: apache/attic-polygene-java

@Test
public void script17()
{
  QueryBuilder<Nameable> qb = this.moduleInstance.newQueryBuilder( Nameable.class );
  // should return only 3 entities starting with forth one
  Nameable nameable = templateFor( Nameable.class );
  Query<Nameable> query = unitOfWork.newQuery( qb );
  query.orderBy( orderBy( nameable.name() ) );
  query.firstResult( 3 );
  query.maxResults( 2 );
  System.out.println( "*** script17: " + query );
  verifyOrderedResults( query, "Felix", "Gaming" );
}

代码示例来源:origin: apache/attic-polygene-java

@Test
public void givenPlainQueryWhenFirstResultIsBeyondFirstElementExpectLimitedResult()
{
  Query<TestComposite> query = queryBuilderFactory.newQueryBuilder( TestComposite.class ).newQuery( composites );
  query.firstResult( 2 );
  verifyOrder( query, "3451" );
}

代码示例来源:origin: apache/attic-polygene-java

@Test
public void givenOrderAndFirstAndMaxResultsQueryWhenExecutedThenReturnCorrect()
{
  QueryBuilder<Nameable> qb = qbf.newQueryBuilder( Nameable.class );
  // should return only 3 entities starting with forth one
  Nameable nameable = templateFor( Nameable.class );
  Query<Nameable> query = qb.newQuery( Network.nameables() );
  query.orderBy( orderBy( nameable.name() ) );
  query.firstResult( 3 );
  query.maxResults( 3 );
  verifyOrderedResults(
    query,
    "Gaming", "Jack Doe", "Joe Doe"
  );
}

相关文章