本文整理了Java中org.hibernate.ScrollableResults.last()
方法的一些代码示例,展示了ScrollableResults.last()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ScrollableResults.last()
方法的具体详情如下:
包路径:org.hibernate.ScrollableResults
类名称:ScrollableResults
方法名:last
[英]Go to the last result.
[中]转到最后一个结果。
代码示例来源:origin: hibernate/hibernate-orm
Parent p = (Parent) results.get( 0 );
assertResultFromOneUser( p );
results.last();
代码示例来源:origin: hibernate/hibernate-orm
assertTrue( iter.first() );
assertTrue( iter.get(0)==f1 );
assertTrue( iter.last() );
assertTrue( iter.get(0)==f4 );
assertTrue( iter.previous() );
assertTrue( iter.first() );
assertTrue( iter.get(0)==f1 );
assertTrue( iter.last() );
assertTrue( iter.get(0)==f4 );
assertTrue( iter.previous() );
代码示例来源:origin: hibernate/hibernate-orm
assertFalse( results.next() );
assertTrue( results.last() );
assertTrue( results.isFirst() );
assertTrue( results.isLast() );
代码示例来源:origin: hibernate/hibernate-orm
assertFalse( results.next() );
assertFalse( results.last() );
assertFalse( results.isFirst() );
assertFalse( results.isLast() );
代码示例来源:origin: com.atlassian.hibernate/hibernate.adapter
@Override
public boolean last() throws HibernateException {
try {
return results.last();
} catch (final PersistenceException ex) {
throw HibernateExceptionAdapter.adapt(ex);
}
}
代码示例来源:origin: stackoverflow.com
ScrollableResults scrollable = criteria.scroll(ScrollMode.SCROLL_INSENSITIVE);
if(scrollable.last()){//returns true if there is a resultset
genericDTO.setTotalCount(scrollable.getRowNumber() + 1);
criteria.setFirstResult(command.getStart())
.setMaxResults(command.getLimit());
genericDTO.setLineItems(Collections.unmodifiableList(criteria.list()));
}
scrollable.close();
return genericDTO;
代码示例来源:origin: com.revolsys.open/com.revolsys.open.orm.hibernate
/**
* Construct a new HibernateQueryPager.
*
* @param query The Hibernate query.
*/
public HibernateQueryPager(final Query query) {
this.query = query;
final ScrollableResults scrollableResults = query.scroll();
scrollableResults.last();
this.numResults = scrollableResults.getRowNumber() + 1;
}
代码示例来源:origin: badqiu/rapid-framework
private static int queryTatalCountByScrollableResults(Query query) {
ScrollableResults scrollableResults = query.scroll();
scrollableResults.last();
return scrollableResults.getRowNumber() + 1;
}
代码示例来源:origin: com.revolsys.open/com.revolsys.open.orm.hibernate
/**
* Construct a new HibernateQueryPager.
*
* @param criteria The Hibernate criteria.
*/
public HibernateCriteriaPager(final Criteria criteria) {
this.criteria = criteria;
final ScrollableResults scrollableResults = criteria.scroll();
scrollableResults.last();
this.numResults = scrollableResults.getRowNumber() + 1;
}
代码示例来源:origin: stackoverflow.com
Criteria criteria = ...;
ScrollableResults scroll = criteria.scroll();
Object[] firstRow = scroll.get(); // or use other methods for getting the data
scroll.last();
Object[] lastRow = scroll.get();
代码示例来源:origin: stackoverflow.com
final Criteria criteria = session.createCriteria(clazz);
List<Criterion> restrictions = factory.assemble(command.getFilter());
for (Criterion restriction : restrictions)
criteria.add(restriction);
criteria.add(Restrictions.conjunction());
if(this.projections != null)
criteria.setProjection(factory.loadProjections(this.projections));
criteria.addOrder(command.getDir().equals("ASC")?Order.asc(command.getSort()):Order.desc(command.getSort()));
ScrollableResults scrollable = criteria.scroll(ScrollMode.SCROLL_INSENSITIVE);
if(scrollable.last()){//returns true if there is a resultset
genericDTO.setTotalCount(scrollable.getRowNumber() + 1);
criteria.setFirstResult(command.getStart())
.setMaxResults(command.getLimit());
genericDTO.setLineItems(Collections.unmodifiableList(criteria.list()));
}
scrollable.close();
return genericDTO;
代码示例来源:origin: org.andromda.samples.animalquiz/animal-quiz-core
scrollableResults.last();
int totalCount = scrollableResults.getRowNumber();
totalCount = totalCount >= 0 ? totalCount + 1 : 0;
代码示例来源:origin: org.andromda.samples.carrental/car-rental-system-core
scrollableResults.last();
int totalCount = scrollableResults.getRowNumber();
totalCount = totalCount >= 0 ? totalCount + 1 : 0;
代码示例来源:origin: org.andromda.samples.carrental/car-rental-system-core
scrollableResults.last();
int totalCount = scrollableResults.getRowNumber();
totalCount = totalCount >= 0 ? totalCount + 1 : 0;
代码示例来源:origin: org.andromda.samples.carrental/car-rental-system-core
scrollableResults.last();
int totalCount = scrollableResults.getRowNumber();
totalCount = totalCount >= 0 ? totalCount + 1 : 0;
代码示例来源:origin: org.andromda.samples.carrental/car-rental-system-core
scrollableResults.last();
int totalCount = scrollableResults.getRowNumber();
totalCount = totalCount >= 0 ? totalCount + 1 : 0;
代码示例来源:origin: stackoverflow.com
String hql = "FROM Foo f order by f.name";
Query query = session.createQuery(hql);
int pageSize = 10;
ScrollableResults resultScroll = query.scroll(ScrollMode.FORWARD_ONLY);
resultScroll.first();
resultScroll.scroll(0);
List<Foo> fooPage = Lists.newArrayList();
int i = 0;
while (pageSize > i++) {
fooPage.add((Foo) resultScroll.get(0));
if (!resultScroll.next())
break;
}
//Total count
resultScroll.last();
int totalResults = resultScroll.getRowNumber() + 1;
代码示例来源:origin: hibernate/hibernate-search
assertTrue( scrollableResults.last() );
int position = scrollableResults.getRowNumber();
assertEquals( 323, position );
代码示例来源:origin: hibernate/hibernate-search
.scroll();
assertEquals( -1, scrollableResults.getRowNumber() );
assertTrue( scrollableResults.last() );
assertEquals( 110, scrollableResults.getRowNumber() );
scrollableResults.beforeFirst();
代码示例来源:origin: hibernate/hibernate-search
assertEquals( 1004, result[0] );
results.last();
result = results.get();
assertEquals( 1004, result[0] );
内容来源于网络,如有侵权,请联系作者删除!