本文整理了Java中org.hibernate.ScrollableResults.setRowNumber()
方法的一些代码示例,展示了ScrollableResults.setRowNumber()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ScrollableResults.setRowNumber()
方法的具体详情如下:
包路径:org.hibernate.ScrollableResults
类名称:ScrollableResults
方法名:setRowNumber
[英]Set the current position in the result set. Can be numbered from the first position (positive number) or the last row (negative number).
[中]设置结果集中的当前位置。可以从第一个位置(正数)或最后一行(负数)开始编号。
代码示例来源:origin: hibernate/hibernate-orm
assertEquals( "scroll(-1) did not return expected row", data.root1Id, animal.getId() );
results.setRowNumber( 1 );
animal = ( Animal ) results.get( 0 );
assertEquals( "setRowNumber(1) did not return expected row", data.root1Id, animal.getId() );
results.setRowNumber( 2 );
animal = ( Animal ) results.get( 0 );
assertEquals( "setRowNumber(2) did not return expected row", data.root2Id, animal.getId() );
代码示例来源:origin: hibernate/hibernate-orm
assertTrue( results.setRowNumber( 1 ) );
assertTrue( results.isFirst() );
assertTrue( results.isLast() );
assertFalse( results.isLast() );
assertTrue( results.setRowNumber( 1 ) );
assertTrue( results.isFirst() );
assertTrue( results.isLast() );
assertFalse( results.setRowNumber( i ) );
assertFalse( results.isFirst() );
assertFalse( results.isLast() );
assertFalse( results.setRowNumber( - i ) );
assertFalse( results.isFirst() );
assertFalse( results.isLast() );
代码示例来源:origin: hibernate/hibernate-orm
assertFalse( results.isLast() );
assertFalse( results.setRowNumber( i ) );
assertFalse( results.isFirst() );
assertFalse( results.isLast() );
assertFalse( results.setRowNumber( - i ) );
assertFalse( results.isFirst() );
assertFalse( results.isLast() );
代码示例来源:origin: com.atlassian.hibernate/hibernate.adapter
@Override
public boolean setRowNumber(final int rowNumber) throws HibernateException {
try {
return results.setRowNumber(rowNumber);
} catch (final PersistenceException ex) {
throw HibernateExceptionAdapter.adapt(ex);
}
}
}
代码示例来源:origin: sakaiproject/sakai
public Object doInHibernate(Session session) throws HibernateException{
ArrayList page = new ArrayList();
Query q = session.createQuery(queryString);
if (value != null) {
q.setInteger(0, value.intValue());
}
ScrollableResults assessmentList = q.scroll();
if (assessmentList.first()){ // check that result set is not empty
int first = pageSize * (pageNumber - 1);
int i = 0;
assessmentList.setRowNumber(first);
assessmentList.beforeFirst();
while ( (pageSize > i++) && assessmentList.next()){
log.debug("**** add "+i);
page.add(assessmentList.get(0));
}
}
return page;
}
};
代码示例来源:origin: org.sakaiproject.samigo/samigo-services
public Object doInHibernate(Session session) throws HibernateException{
ArrayList page = new ArrayList();
Query q = session.createQuery(queryString);
if (value != null) {
q.setInteger(0, value.intValue());
}
ScrollableResults assessmentList = q.scroll();
if (assessmentList.first()){ // check that result set is not empty
int first = pageSize * (pageNumber - 1);
int i = 0;
assessmentList.setRowNumber(first);
assessmentList.beforeFirst();
while ( (pageSize > i++) && assessmentList.next()){
log.debug("**** add "+i);
page.add(assessmentList.get(0));
}
}
return page;
}
};
内容来源于网络,如有侵权,请联系作者删除!