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

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

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

Query.count介绍

[英]Count how many results would be returned by this Query. This executes the Query.
[中]计算此查询将返回多少个结果。这将执行查询。

代码示例

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

@Override
  public void expect()
    throws Exception
  {
    assertThat( query.count(), equalTo(1) );
    Male male = query.find();
    assertThat( male.title().get(), equalTo( Person.Title.MR ));
  }
}

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

@Override
  public void expect()
    throws Exception
  {
    assertThat( query.count(), equalTo(1) );
    Male male = query.find();
    assertThat( male.title().get(), equalTo( Person.Title.MR ));
  }
}

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

@Override
  public void expect()
    throws Exception
  {
    assertThat( query.count(), equalTo(1) );
    Male male = query.find();
    assertThat( male.title().get(), equalTo( Person.Title.MR ));
    assertThat( male.name().get(), equalTo( "Joe Doe" ));
  }
}

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

@Override
  public void expect()
    throws Exception
  {
    assertThat( query.count(), equalTo(1) );
    Male male = query.find();
    assertThat( male.title().get(), equalTo( Person.Title.MR ));
    assertThat( male.name().get(), equalTo( "Joe Doe" ));
  }
}

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

private void verifyOrder( Query<TestComposite> query, String expected )
{
  String actual = "";
  for( TestComposite testComposite : query )
  {
    actual = actual + testComposite.b().get();
  }
  assertThat( "Query is correct", actual, equalTo( expected ) );
  assertThat( "Count is correct", query.count(), equalTo( (long) expected.length() ) );
}

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

Query<ExampleEntity> query = uow.newQuery( this.queryBuilderFactory.newQueryBuilder( ExampleEntity.class ).
    where( QueryExpressions.contains( QueryExpressions.templateFor( ExampleEntity.class ).manyAssoc(), entity50) ));
System.out.println(query.count());

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

@Test
public void givenPlainQueryWhenFindEntityExpectFirstEntityReturned()
{
  Query<TestComposite> query = queryBuilderFactory.newQueryBuilder( TestComposite.class ).newQuery( composites );
  assertEquals( "A", query.find().a().get() );
  assertEquals( 6, query.count() );
}

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

Query<MyEntity> q = uow.newQuery( qBuilder );
assertEquals( 1, q.count() );
assertEquals( TEST_NAME, q.iterator().next().name().get() );

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

assertEquals( 1, query.count() );
post = query.find();
assertNotNull( post );
queryBuilder = queryBuilderFactory.newQueryBuilder( Post.class ).where( eq( post.title(), title ) );
query = uow.newQuery( queryBuilder );
assertEquals( 1, query.count() );
post = query.find();
assertNotNull( post );
                 .where( eq( post.title(), "Not available" ) );
query = uow.newQuery( queryBuilder );
assertEquals( 0, query.count() );
                 .where( ne( post.title(), "Not available" ) );
query = uow.newQuery( queryBuilder );
assertEquals( 1, query.count() );
                 .where( eq( post.author().get().nickname(), "eskatos" ) );
query = uow.newQuery( queryBuilder );
assertEquals( 1, query.count() );
post = query.find();
assertNotNull( post );

相关文章