Package org.hibernate.classic

Examples of org.hibernate.classic.Session.iterate()


      s.save(next);
      last.setNext(next);
      last = next;
      last.setOrder( (short) (i+1) );
    }
    Iterator iter = s.iterate("from Glarch g");
    while ( iter.hasNext() ) {
      iter.next();
    }
    List list = s.find("from Glarch g");
    assertTrue( "recursive find", list.size()==6 );
View Full Code Here


    txn.commit();
    s.close();

    s = openSession();
    txn = s.beginTransaction();
    iter = s.iterate("from Glarch g order by g.order asc");
    while ( iter.hasNext() ) {
      GlarchProxy g = (GlarchProxy) iter.next();
      assertTrue( "not null", g!=null );
      iter.remove();
    }
View Full Code Here

      s.save(foo);
      flast.setFoo(foo);
      flast = flast.getFoo();
      flast.setString( "foo" + (i+1) );
    }
    iter = s.iterate("from Foo foo");
    while ( iter.hasNext() ) {
      iter.next();
    }
    list = s.find("from Foo foo");
    assertTrue( "recursive find", list.size()==6 );
View Full Code Here

    txn.commit();
    s.close();

    s = openSession();
    txn = s.beginTransaction();
    iter = s.iterate("from Foo foo order by foo.string asc");
    while ( iter.hasNext() ) {
      BarProxy bar = (BarProxy) iter.next();
      assertTrue( "not null", bar!=null );
      iter.remove();
    }
View Full Code Here

    s.save(foo1);
    foo.setFoo(foo1);
    List l = s.find("select parent, child from Foo parent, Foo child where parent.foo = child");
    assertTrue( "multi-column find", l.size()==1 );

    Iterator rs = s.iterate("select count(distinct child.id), count(distinct parent.id) from Foo parent, Foo child where parent.foo = child");
    Object[] row = (Object[]) rs.next();
    assertTrue( "multi-column count", ( (Long) row[0] ).intValue()==1 );
    assertTrue( "multi-column count", ( (Long) row[1] ).intValue()==1 );
    assertTrue( !rs.hasNext() );
View Full Code Here

    Object[] row = (Object[]) rs.next();
    assertTrue( "multi-column count", ( (Long) row[0] ).intValue()==1 );
    assertTrue( "multi-column count", ( (Long) row[1] ).intValue()==1 );
    assertTrue( !rs.hasNext() );

    rs = s.iterate("select child.id, parent.id, child.long from Foo parent, Foo child where parent.foo = child");
    row = (Object[]) rs.next();
    assertTrue( "multi-column id", row[0].equals( foo.getFoo().getKey() ) );
    assertTrue( "multi-column id", row[1].equals( foo.getKey() ) );
    assertTrue( "multi-column property", row[2].equals( foo.getFoo().getLong() ) );
    assertTrue( !rs.hasNext() );
View Full Code Here

    assertTrue( "multi-column id", row[0].equals( foo.getFoo().getKey() ) );
    assertTrue( "multi-column id", row[1].equals( foo.getKey() ) );
    assertTrue( "multi-column property", row[2].equals( foo.getFoo().getLong() ) );
    assertTrue( !rs.hasNext() );

    rs = s.iterate("select child.id, parent.id, child.long, child, parent.foo from Foo parent, Foo child where parent.foo = child");
    row = (Object[]) rs.next();
    assertTrue(
      foo.getFoo().getKey().equals( row[0] ) &&
      foo.getKey().equals( row[1] ) &&
      foo.getFoo().getLong().equals( row[2] ) &&
View Full Code Here

    txn.commit();
    s.close();
   
    s = openSession();
    txn = s.beginTransaction();
    Iterator iter = s.iterate("select parent, child from Foo parent, Foo child where parent.foo = child and parent.string='a string'");
    int deletions=0;
    while ( iter.hasNext() ) {
      Object[] pnc = (Object[]) iter.next();
      s.delete( pnc[0] );
      s.delete( pnc[1] );
View Full Code Here

    s = openSession();
    t = s.beginTransaction();
    baz = (Baz) s.load( Baz.class, baz.getCode() );
    assertTrue( baz.getFees().size()==2 );
    s.delete(baz);
    assertTrue( !s.iterate("from Fee fee").hasNext() );
    t.commit();
    s.close();

  }
View Full Code Here

    assertTrue( s.find("from Bar bar join bar.baz.fooArray foo").size()==1 );

    s.delete(bar);

    if ( getDialect() instanceof DB2Dialect || getDialect() instanceof PostgreSQLDialect ) {
      s.iterate("select one from One one join one.manies many group by one order by count(many)");
      s.iterate("select one from One one join one.manies many group by one having count(many) < 5");
    }

    s.find("from One one join one.manies many where one.id = 1 and many.id = 1");
    s.iterate("select one.id, elements(one.manies) from One one");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.