@Test public void script17() throws EntityFinderException { Nameable nameable = templateFor( Nameable.class ); final Query<Nameable> query = unitOfWork.newQuery( this.module .newQueryBuilder( Nameable.class ) .where( queries.get( "script17" ) ) ); query.orderBy( orderBy( nameable.name() ) ); query.firstResult( 3 ); query.maxResults( 3 ); System.out.println( "*** script17: " + query ); verifyOrderedResults( query, "Gaming", "Jack Doe", "Joe Doe" ); }
@Test public void script17() throws EntityFinderException { QueryBuilder<Nameable> qb = this.module.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, "Gaming", "Jack Doe" ); }
@Override public Query<X509Profile> findByNamePaginated( String name, int firstResult, int maxResults ) { QueryBuilder<X509Profile> builder = qbf.newQueryBuilder( getBoxedClass() ); builder = builder.where( eq( templateFor( X509Profile.class ).name(), name ) ); Query<X509Profile> query = builder.newQuery( uowf.currentUnitOfWork() ). firstResult( firstResult ). maxResults( maxResults ); return query; }
@Override public Query<CA> findByNamePaginated( String name, int firstResult, int maxResults ) { QueryBuilder<CA> builder = qbf.newQueryBuilder( getBoxedClass() ); builder = builder.where( eq( templateFor( CA.class ).name(), name ) ); Query<CA> query = builder.newQuery( uowf.currentUnitOfWork() ). firstResult( firstResult ). maxResults( maxResults ); return query; }