Package org.hibernate.classic

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


      if ( foo==i.next() ) found = true;
    }
    assertTrue(found);

    baz.getFooArray()[0] = null;
    i = s.iterate("select foo from Baz baz join baz.fooArray foo");
    assertTrue( !i.hasNext() );
    baz.getFooArray()[0] = foo;
    i = s.iterate("select elements(baz.fooArray) from Baz baz");
    assertTrue( i.hasNext() );
View Full Code Here


    baz.getFooArray()[0] = null;
    i = s.iterate("select foo from Baz baz join baz.fooArray foo");
    assertTrue( !i.hasNext() );
    baz.getFooArray()[0] = foo;
    i = s.iterate("select elements(baz.fooArray) from Baz baz");
    assertTrue( i.hasNext() );

    if ( !(getDialect() instanceof MySQLDialect) && !(getDialect() instanceof HSQLDialect) && !(getDialect() instanceof InterbaseDialect) && !(getDialect() instanceof PointbaseDialect) && !(getDialect() instanceof SAPDBDialect) )  {
      baz.getFooArray()[0] = null;
      i = s.iterate(
View Full Code Here

    i = s.iterate("select elements(baz.fooArray) from Baz baz");
    assertTrue( i.hasNext() );

    if ( !(getDialect() instanceof MySQLDialect) && !(getDialect() instanceof HSQLDialect) && !(getDialect() instanceof InterbaseDialect) && !(getDialect() instanceof PointbaseDialect) && !(getDialect() instanceof SAPDBDialect) )  {
      baz.getFooArray()[0] = null;
      i = s.iterate(
        "from Baz baz where ? in elements(baz.fooArray)",
        foo, Hibernate.entity(Foo.class)
      );
      assertTrue( !i.hasNext() );
      baz.getFooArray()[0] = foo;
View Full Code Here

        "from Baz baz where ? in elements(baz.fooArray)",
        foo, Hibernate.entity(Foo.class)
      );
      assertTrue( !i.hasNext() );
      baz.getFooArray()[0] = foo;
      i = s.iterate(
        "select foo from Foo foo where foo in "
        + "(select elt from Baz baz join baz.fooArray elt)"
      );
      assertTrue( i.hasNext() );
    }
View Full Code Here

    s.save(q);
    q.getFoo().setString("foo2");
    //s.flush();
    //s.connection().commit();
    assertTrue(
      s.iterate("from Foo foo where foo.dependent.qux.foo.string = 'foo2'").hasNext()
    );
    s.delete(foo);
    txn.commit();
    s.close();
  }
View Full Code Here

    s.save(m);
    t.commit();
    s.close();
    s = openSession();
    t = s.beginTransaction();
    Iterator i = s.iterate("from Master");
    m = (Master) i.next();
    assertTrue( m.getOtherMaster()==m );
    if (getDialect() instanceof HSQLDialect) { m.setOtherMaster(null); s.flush(); }
    s.delete(m);
    t.commit();
View Full Code Here

  public void testDialectSQLFunctions() throws Exception {

    Session s = openSession();
    Transaction t = s.beginTransaction();

    Iterator iter = s.iterate("select max(s.count) from Simple s");

    if ( getDialect() instanceof MySQLDialect ) assertTrue( iter.hasNext() && iter.next()==null );

    Simple simple = new Simple();
    simple.setName("Simple Dialect Function Test");
View Full Code Here

      assertTrue(
        s.find("from Simple s where s = some( select sim from Simple sim where sim.other.count=s.other.count ) and s.other.count > 0").size()==1
      );
    }

    Iterator iter = s.iterate("select sum(s.count) from Simple s group by s.count having sum(s.count) > 10");
    assertTrue( iter.hasNext() );
    assertEquals( new Long(12), iter.next() );
    assertTrue( !iter.hasNext() );
    if ( ! (getDialect() instanceof MySQLDialect) ) {
      iter = s.iterate("select s.count from Simple s group by s.count having s.count = 12");
View Full Code Here

    Iterator iter = s.iterate("select sum(s.count) from Simple s group by s.count having sum(s.count) > 10");
    assertTrue( iter.hasNext() );
    assertEquals( new Long(12), iter.next() );
    assertTrue( !iter.hasNext() );
    if ( ! (getDialect() instanceof MySQLDialect) ) {
      iter = s.iterate("select s.count from Simple s group by s.count having s.count = 12");
      assertTrue( iter.hasNext() );
    }

    s.iterate("select s.id, s.count, count(t), max(t.date) from Simple s, Simple t where s.count = t.count group by s.id, s.count order by s.count");
View Full Code Here

    if ( ! (getDialect() instanceof MySQLDialect) ) {
      iter = s.iterate("select s.count from Simple s group by s.count having s.count = 12");
      assertTrue( iter.hasNext() );
    }

    s.iterate("select s.id, s.count, count(t), max(t.date) from Simple s, Simple t where s.count = t.count group by s.id, s.count order by s.count");

    Query q = s.createQuery("from Simple s");
    q.setMaxResults(10);
    assertTrue( q.list().size()==3 );
    q = s.createQuery("from Simple s");
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.