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

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

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

Query.maxResults介绍

[英]Set how many results should be returned. Default is that there is no limit set.
[中]设置应该返回多少个结果。默认情况下,没有设置限制。

代码示例

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

@Test
public void script16()
{
  Nameable nameable = templateFor( Nameable.class );
  final Query<Nameable> query = unitOfWork.newQuery( this.moduleInstance
    .newQueryBuilder( Nameable.class )
    .where( queries.get( "script16" ) ) );
  query.orderBy( orderBy( nameable.name() ) );
  query.maxResults( 2 );
  System.out.println( "*** script16: " + query );
  verifyOrderedResults( query, "Ann Doe", "Cars" );
}

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

@Test
public void script16()
{
  Nameable nameable = templateFor( Nameable.class );
  final Query<Nameable> query = unitOfWork.newQuery( this.moduleInstance
    .newQueryBuilder( Nameable.class )
    .where( queries.get( "script16" ) ) );
  query.orderBy( orderBy( nameable.name() ) );
  query.maxResults( 2 );
  System.out.println( "*** script16: " + query );
  verifyOrderedResults( query, "Ann Doe", "Cars" );
}

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

@Test
public void script16()
{
  QueryBuilder<Nameable> qb = this.moduleInstance.newQueryBuilder( Nameable.class );
  // should return only 2 entities
  Nameable nameable = templateFor( Nameable.class );
  Query<Nameable> query = unitOfWork.newQuery( qb );
  query.orderBy( orderBy( nameable.name() ) );
  query.maxResults( 2 );
  System.out.println( "*** script16: " + query );
  verifyOrderedResults( query, "Ann Doe", "Cars" );
}

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

@Test
public void script16()
{
  QueryBuilder<Nameable> qb = this.moduleInstance.newQueryBuilder( Nameable.class );
  // should return only 2 entities
  Nameable nameable = templateFor( Nameable.class );
  Query<Nameable> query = unitOfWork.newQuery( qb );
  query.orderBy( orderBy( nameable.name() ) );
  query.maxResults( 2 );
  System.out.println( "*** script16: " + query );
  verifyOrderedResults( query, "Ann Doe", "Cars" );
}

代码示例来源: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: 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: 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

private void doRemove( int howMany )
{
  Iterator<ExampleEntity> iter = this.unitOfWorkFactory.currentUnitOfWork().newQuery( this.queryBuilderFactory.newQueryBuilder( ExampleEntity.class )).maxResults( howMany ).iterator();
  Integer removed = 0;
  while (iter.hasNext())
  {
    this.unitOfWorkFactory.currentUnitOfWork().remove( iter.next() );
    ++removed;
  }
  if (removed != howMany)
  {
    LOG.warn( "Removed " + removed + " entities instead of " + howMany + "." );
  }
}

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

@Test
public void givenPlainQueryWhenMaxedResultExpectLimitedResult()
{
  Query<TestComposite> query = queryBuilderFactory.newQueryBuilder( TestComposite.class ).newQuery( composites );
  query.maxResults( 5 );
  verifyOrder( query, "62345" );
}

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

@Test
public void givenOrderAndMaxResultsQueryWhenExecutedThenReturnCorrect()
{
  QueryBuilder<Nameable> qb = qbf.newQueryBuilder( Nameable.class );
  // should return only 2 entities
  Nameable nameable = templateFor( Nameable.class );
  Query<Nameable> query = qb.newQuery( Network.nameables() );
  query.orderBy( orderBy( nameable.name() ) );
  query.maxResults( 2 );
  verifyOrderedResults(
    query,
    "Ann Doe", "Cars"
  );
}

代码示例来源: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"
  );
}

相关文章