org.hibernate.ScrollableResults.previous()方法的使用及代码示例

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

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

ScrollableResults.previous介绍

[英]Retreat to the previous result.
[中]退回到先前的结果。

代码示例

代码示例来源:origin: hibernate/hibernate-orm

@Test
@SkipForDialect(value = CUBRIDDialect.class, comment = "As of verion 8.4.1 CUBRID doesn't support temporary tables. This test fails with"
    + "HibernateException: cannot doAfterTransactionCompletion multi-table deletes using dialect not supporting temp tables")
@SkipForDialect(value = AbstractHANADialect.class, comment = "HANA only supports forward-only cursors.")
public void testScrollingJoinFetchesReverse() {
  TestData data = new TestData();
  data.prepare();
  Session s = openSession();
  Transaction txn = s.beginTransaction();
   ScrollableResults results = s
        .createQuery(
            "from Animal a left join fetch a.offspring where a.description like :desc order by a.id" )
        .setString( "desc", "root%" ).scroll();
  results.afterLast();
  int counter = 0;
  while ( results.previous() ) {
    counter++;
    Animal animal = ( Animal ) results.get( 0 );
    checkResult( animal );
  }
  assertEquals( "unexpected result count", 2, counter );
  txn.commit();
  s.close();
  data.cleanup();
}

代码示例来源:origin: hibernate/hibernate-orm

assertTrue( iter.last() );
assertTrue( iter.get(0)==f4 );
assertTrue( iter.previous() );
txn.commit();
s.close();
assertTrue( iter.last() );
assertTrue( iter.get(0)==f4 );
assertTrue( iter.previous() );
int i = 0;
for ( Object entity : s.createQuery( "from Foo" ).list() ) {

代码示例来源:origin: hibernate/hibernate-orm

assertFalse( results.previous() );
assertFalse( results.isLast() );
assertTrue( results.previous() );
assertTrue( results.isFirst() );
assertTrue( results.isLast() );
assertFalse( results.previous() );
assertFalse( results.isFirst() );
assertFalse( results.isLast() );
assertFalse( results.isFirst() );
assertFalse( results.isLast() );
assertFalse( results.previous() );

代码示例来源:origin: hibernate/hibernate-orm

assertFalse( results.isLast() );
assertFalse( results.previous() );
assertFalse( results.isFirst() );
assertFalse( results.isLast() );

代码示例来源:origin: com.atlassian.hibernate/hibernate.adapter

@Override
public boolean previous() throws HibernateException {
  try {
    return results.previous();
  } catch (final PersistenceException ex) {
    throw HibernateExceptionAdapter.adapt(ex);
  }
}

代码示例来源:origin: hibernate/hibernate-search

int position = scrollableResults.getRowNumber();
assertEquals( 323, position );
while ( scrollableResults.previous() ) {
  AlternateBook book = (AlternateBook) scrollableResults.get()[0];
  assertEquals( --position, book.getId().intValue() );

代码示例来源:origin: hibernate/hibernate-search

while ( scrollableResults.previous() ) {
  position--;
  AlternateBook book = (AlternateBook) scrollableResults.get()[0];

代码示例来源:origin: hibernate/hibernate-search

while ( scrollableResults.previous() ) {
  position--;
  Object[] objs = scrollableResults.get();

代码示例来源:origin: hibernate/hibernate-search

results.previous();
assertTrue( "afterLast() pointer incorrect", results.isLast() );
results.previous();
assertTrue( "large positive scroll() pointer incorrect", results.isLast() );

代码示例来源:origin: hibernate/hibernate-search

assertNull( projection );
projections.previous();
projection = projections.get();
checkProjectionLast( projection, s );

相关文章