本文整理了Java中org.apache.polygene.api.query.Query.orderBy
方法的一些代码示例,展示了Query.orderBy
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.orderBy
方法的具体详情如下:
包路径:org.apache.polygene.api.query.Query
类名称:Query
方法名:orderBy
[英]Append an ascending ordering rule to the existing segments.
[中]将升序规则附加到现有段。
代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport
@Test
public void script20()
{
Person person = templateFor( Person.class );
final Query<Person> query = unitOfWork.newQuery( this.moduleInstance
.newQueryBuilder( Person.class )
.where( queries.get( "script20" ) ) );
query.orderBy( orderBy( person.name(), OrderBy.Order.DESCENDING ) );
System.out.println( "*** script20: " + query );
verifyOrderedResults( query, "Joe Doe", "Ann Doe" );
}
代码示例来源:origin: apache/attic-polygene-java
@Test
public void script19()
{
Nameable nameable = templateFor( Nameable.class );
final Query<Nameable> query = unitOfWork.newQuery( this.moduleInstance
.newQueryBuilder( Nameable.class )
.where( queries.get( "script19" ) ) );
query.orderBy( orderBy( nameable.name() ) );
System.out.println( "*** script19: " + query );
verifyOrderedResults( query, "Felix", "Gaming", "Jack Doe", "Joe Doe", "Kuala Lumpur", "Penang", "Programming" );
}
代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport
@Test
public void script19()
{
Nameable nameable = templateFor( Nameable.class );
final Query<Nameable> query = unitOfWork.newQuery( this.moduleInstance
.newQueryBuilder( Nameable.class )
.where( queries.get( "script19" ) ) );
query.orderBy( orderBy( nameable.name() ) );
System.out.println( "*** script19: " + query );
verifyOrderedResults( query, "Felix", "Gaming", "Jack Doe", "Joe Doe", "Kuala Lumpur", "Penang", "Programming" );
}
代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport
@Test
public void script18()
{
Nameable nameable = templateFor( Nameable.class );
Predicate<Composite> predicate = queries.get( "script18" );
final Query<Nameable> query = unitOfWork.newQuery( this.moduleInstance
.newQueryBuilder( Nameable.class )
.where( predicate ) );
query.orderBy( orderBy( nameable.name() ) );
System.out.println( "*** script18: " + query );
verifyOrderedResults( query, "Ann Doe", "Cars", "Cooking", "Felix", "Gaming", "Jack Doe", "Joe Doe",
"Kuala Lumpur", "Penang", "Programming" );
}
代码示例来源:origin: apache/attic-polygene-java
public Query<Forum> forums()
{
return uowf.currentUnitOfWork()
.newQuery( qbf.newQueryBuilder( Forum.class ) )
.orderBy( templateFor( Forum.class ).name() );
}
}
代码示例来源:origin: apache/attic-polygene-java
@Override
public Query<User> users()
{
return uowf.currentUnitOfWork()
.newQuery( qbf.newQueryBuilder( User.class ) )
.orderBy( templateFor( User.class ).realName() );
}
代码示例来源: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()
{
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 script18()
{
QueryBuilder<Nameable> qb = this.moduleInstance.newQueryBuilder( Nameable.class );
// should return all Nameable entities sorted by name
Nameable nameable = templateFor( Nameable.class );
Query<Nameable> query = unitOfWork.newQuery( qb );
query.orderBy( orderBy( nameable.name() ) );
System.out.println( "*** script18: " + query );
verifyOrderedResults( query, "Ann Doe", "Cars", "Cooking", "Felix", "Gaming", "Jack Doe", "Joe Doe", "Kuala Lumpur",
"Penang", "Programming" );
}
代码示例来源: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 script21()
{
Person person = templateFor( Person.class );
final Query<Person> query = unitOfWork.newQuery( this.moduleInstance
.newQueryBuilder( Person.class )
.where( queries.get( "script21" ) ) );
query.orderBy( orderBy( person.placeOfBirth().get().name() ), orderBy( person.yearOfBirth() ) );
System.out.println( "*** script21: " + query );
verifyOrderedResults( query, "Ann Doe", "Joe Doe", "Jack Doe" );
}
代码示例来源:origin: apache/attic-polygene-java
@Test
public void script21()
{
Person person = templateFor( Person.class );
final Query<Person> query = unitOfWork.newQuery( this.moduleInstance
.newQueryBuilder( Person.class )
.where( queries.get( "script21" ) ) );
query.orderBy( orderBy( person.placeOfBirth().get().name() ), orderBy( person.yearOfBirth() ) );
System.out.println( "*** script21: " + query );
verifyOrderedResults( query, "Ann Doe", "Joe Doe", "Jack Doe" );
}
代码示例来源:origin: apache/attic-polygene-java
@Test
public void script20()
{
QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
// should return all Persons born after 1973 (Ann and Joe Doe) sorted descending by name
Person person = templateFor( Person.class );
Query<Person> query = unitOfWork.newQuery( qb.where( gt( person.yearOfBirth(), 1973 ) ) );
query.orderBy( orderBy( person.name(), OrderBy.Order.DESCENDING ) );
System.out.println( "*** script20: " + query );
verifyOrderedResults( query, "Joe Doe", "Ann Doe" );
}
代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport
@Test
public void script20()
{
QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
// should return all Persons born after 1973 (Ann and Joe Doe) sorted descending by name
Person person = templateFor( Person.class );
Query<Person> query = unitOfWork.newQuery( qb.where( gt( person.yearOfBirth(), 1973 ) ) );
query.orderBy( orderBy( person.name(), OrderBy.Order.DESCENDING ) );
System.out.println( "*** script20: " + query );
verifyOrderedResults( query, "Joe Doe", "Ann Doe" );
}
代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport
@Test
public void script19()
{
QueryBuilder<Nameable> qb = this.moduleInstance.newQueryBuilder( Nameable.class );
// should return all Nameable entities with a name > "D" sorted by name
Nameable nameable = templateFor( Nameable.class );
Query<Nameable> query = unitOfWork.newQuery( qb.where( gt( nameable.name(), "D" ) ) );
query.orderBy( orderBy( nameable.name() ) );
System.out.println( "*** script19: " + query );
verifyOrderedResults( query, "Felix", "Gaming", "Jack Doe", "Joe Doe", "Kuala Lumpur", "Penang", "Programming" );
}
代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport
@Test
public void script21()
{
QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
// should return all Persons sorted by name of the city they were born, and then by year they were born
Person person = templateFor( Person.class );
Query<Person> query = unitOfWork.newQuery( qb );
query.orderBy( orderBy( person.placeOfBirth().get().name() ), orderBy( person.yearOfBirth() ) );
System.out.println( "*** script21: " + query );
verifyOrderedResults( query, "Ann Doe", "Joe Doe", "Jack Doe" );
}
代码示例来源:origin: apache/attic-polygene-java
@Test
public void givenPlainQueryWhenOrderBySecondPropertyExpectOrderedResult()
{
Query<TestComposite> query = queryBuilderFactory.newQueryBuilder( TestComposite.class ).newQuery( composites );
TestComposite template = templateFor( TestComposite.class );
query.orderBy( orderBy( template.b() ) );
verifyOrder( query, "123456" );
}
代码示例来源:origin: apache/attic-polygene-java
@Test
public void givenPlainQueryWhenOrderByTwoPropertiesExpectOrderedResult()
{
Query<TestComposite> query = queryBuilderFactory.newQueryBuilder( TestComposite.class ).newQuery( composites );
TestComposite template = templateFor( TestComposite.class );
query.orderBy( orderBy( template.a() ), orderBy( template.b() ) );
verifyOrder( query, "162345" );
}
代码示例来源:origin: apache/attic-polygene-java
@Test
public void givenOrderByMultipleQueryWhenExecutedThenReturnCorrect()
{
QueryBuilder<Person> qb = qbf.newQueryBuilder( Person.class );
// should return all Persons sorted by name of the city they were born, and then by year they were born
Person person = templateFor( Person.class );
Query<Person> query = qb.newQuery( Network.persons() );
query.orderBy( orderBy( person.placeOfBirth().get().name() ),
orderBy( person.yearOfBirth() ) );
verifyOrderedResults( query, "Ann Doe", "Joe Doe", "Vivian Smith", "Jack Doe" );
}
内容来源于网络,如有侵权,请联系作者删除!