Package org.hibernate.classic

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


    s.save( new Holder("ice T") );
    s.save( new Holder("ice cube") );

    assertTrue( s.find("from java.lang.Object as o").size()==15 );
    assertTrue( s.find("from Named").size()==7 );
    assertTrue( s.find("from Named n where n.name is not null").size()==4 );
    iter = s.iterate("from Named n");
    while ( iter.hasNext() ) {
      assertTrue( iter.next() instanceof Named );
    }
View Full Code Here


      Object[] row = (Object[]) iter.next();
      if ( row[0]!=row[1] ) cnt++;
    }
    if ( !(getDialect() instanceof HSQLDialect) ) {
      assertTrue(cnt==2);
      assertTrue( s.find("from Named n0, Named n1 where n0.name = n1.name").size()==7 );
    }

    Query qu = s.createQuery("from Named n where n.name = :name");
    qu.getReturnTypes();
    qu.getNamedParameters();
View Full Code Here

    s.iterate("select baz.code, min(baz.count) from Baz baz group by baz.code");

    iter = s.iterate("selecT baz from Baz baz where baz.stringDateMap['foo'] is not null or baz.stringDateMap['bar'] = ?", new Date(), Hibernate.DATE);
    assertFalse( iter.hasNext() );
    list = s.find("select baz from Baz baz where baz.stringDateMap['now'] is not null");
    assertTrue( list.size()==1 );
    list = s.find("select baz from Baz baz where baz.stringDateMap['now'] is not null and baz.stringDateMap['big bang'] < baz.stringDateMap['now']");
    assertTrue( list.size()==1 );
    list = s.find("select index(date) from Baz baz join baz.stringDateMap date");
    System.out.println(list);
View Full Code Here

    iter = s.iterate("selecT baz from Baz baz where baz.stringDateMap['foo'] is not null or baz.stringDateMap['bar'] = ?", new Date(), Hibernate.DATE);
    assertFalse( iter.hasNext() );
    list = s.find("select baz from Baz baz where baz.stringDateMap['now'] is not null");
    assertTrue( list.size()==1 );
    list = s.find("select baz from Baz baz where baz.stringDateMap['now'] is not null and baz.stringDateMap['big bang'] < baz.stringDateMap['now']");
    assertTrue( list.size()==1 );
    list = s.find("select index(date) from Baz baz join baz.stringDateMap date");
    System.out.println(list);
    assertTrue( list.size()==2 );
View Full Code Here

    assertFalse( iter.hasNext() );
    list = s.find("select baz from Baz baz where baz.stringDateMap['now'] is not null");
    assertTrue( list.size()==1 );
    list = s.find("select baz from Baz baz where baz.stringDateMap['now'] is not null and baz.stringDateMap['big bang'] < baz.stringDateMap['now']");
    assertTrue( list.size()==1 );
    list = s.find("select index(date) from Baz baz join baz.stringDateMap date");
    System.out.println(list);
    assertTrue( list.size()==2 );

    s.find("from Foo foo where foo.integer not between 1 and 5 and foo.string not in ('cde', 'abc') and foo.string is not null and foo.integer<=3");
View Full Code Here

    assertTrue( list.size()==1 );
    list = s.find("select index(date) from Baz baz join baz.stringDateMap date");
    System.out.println(list);
    assertTrue( list.size()==2 );

    s.find("from Foo foo where foo.integer not between 1 and 5 and foo.string not in ('cde', 'abc') and foo.string is not null and foo.integer<=3");

    s.find("from Baz baz inner join baz.collectionComponent.nested.foos foo where foo.string is null");
    if ( !(getDialect() instanceof MySQLDialect) && !(getDialect() instanceof MckoiDialect) && !(getDialect() instanceof SAPDBDialect) && !(getDialect() instanceof PointbaseDialect) /*&& !(dialect instanceof Oracle9Dialect)*/ )  {
      s.find("from Baz baz inner join baz.fooSet where '1' in (from baz.fooSet foo where foo.string is not null)");
      s.find("from Baz baz where 'a' in elements(baz.collectionComponent.nested.foos) and 1.0 in elements(baz.collectionComponent.nested.floats)");
View Full Code Here

    System.out.println(list);
    assertTrue( list.size()==2 );

    s.find("from Foo foo where foo.integer not between 1 and 5 and foo.string not in ('cde', 'abc') and foo.string is not null and foo.integer<=3");

    s.find("from Baz baz inner join baz.collectionComponent.nested.foos foo where foo.string is null");
    if ( !(getDialect() instanceof MySQLDialect) && !(getDialect() instanceof MckoiDialect) && !(getDialect() instanceof SAPDBDialect) && !(getDialect() instanceof PointbaseDialect) /*&& !(dialect instanceof Oracle9Dialect)*/ )  {
      s.find("from Baz baz inner join baz.fooSet where '1' in (from baz.fooSet foo where foo.string is not null)");
      s.find("from Baz baz where 'a' in elements(baz.collectionComponent.nested.foos) and 1.0 in elements(baz.collectionComponent.nested.floats)");
      s.find("from Baz baz where 'b' in elements(baz.collectionComponent.nested.foos) and 1.0 in elements(baz.collectionComponent.nested.floats)");
    }
View Full Code Here

    s.find("from Foo foo where foo.integer not between 1 and 5 and foo.string not in ('cde', 'abc') and foo.string is not null and foo.integer<=3");

    s.find("from Baz baz inner join baz.collectionComponent.nested.foos foo where foo.string is null");
    if ( !(getDialect() instanceof MySQLDialect) && !(getDialect() instanceof MckoiDialect) && !(getDialect() instanceof SAPDBDialect) && !(getDialect() instanceof PointbaseDialect) /*&& !(dialect instanceof Oracle9Dialect)*/ )  {
      s.find("from Baz baz inner join baz.fooSet where '1' in (from baz.fooSet foo where foo.string is not null)");
      s.find("from Baz baz where 'a' in elements(baz.collectionComponent.nested.foos) and 1.0 in elements(baz.collectionComponent.nested.floats)");
      s.find("from Baz baz where 'b' in elements(baz.collectionComponent.nested.foos) and 1.0 in elements(baz.collectionComponent.nested.floats)");
    }

    s.find("from Foo foo join foo.foo where foo.foo in ('1','2','3')");
View Full Code Here

    s.find("from Foo foo where foo.integer not between 1 and 5 and foo.string not in ('cde', 'abc') and foo.string is not null and foo.integer<=3");

    s.find("from Baz baz inner join baz.collectionComponent.nested.foos foo where foo.string is null");
    if ( !(getDialect() instanceof MySQLDialect) && !(getDialect() instanceof MckoiDialect) && !(getDialect() instanceof SAPDBDialect) && !(getDialect() instanceof PointbaseDialect) /*&& !(dialect instanceof Oracle9Dialect)*/ )  {
      s.find("from Baz baz inner join baz.fooSet where '1' in (from baz.fooSet foo where foo.string is not null)");
      s.find("from Baz baz where 'a' in elements(baz.collectionComponent.nested.foos) and 1.0 in elements(baz.collectionComponent.nested.floats)");
      s.find("from Baz baz where 'b' in elements(baz.collectionComponent.nested.foos) and 1.0 in elements(baz.collectionComponent.nested.floats)");
    }

    s.find("from Foo foo join foo.foo where foo.foo in ('1','2','3')");
    if ( !(getDialect() instanceof HSQLDialect) ) s.find("from Foo foo left join foo.foo where foo.foo in ('1','2','3')");
View Full Code Here

    s.find("from Baz baz inner join baz.collectionComponent.nested.foos foo where foo.string is null");
    if ( !(getDialect() instanceof MySQLDialect) && !(getDialect() instanceof MckoiDialect) && !(getDialect() instanceof SAPDBDialect) && !(getDialect() instanceof PointbaseDialect) /*&& !(dialect instanceof Oracle9Dialect)*/ )  {
      s.find("from Baz baz inner join baz.fooSet where '1' in (from baz.fooSet foo where foo.string is not null)");
      s.find("from Baz baz where 'a' in elements(baz.collectionComponent.nested.foos) and 1.0 in elements(baz.collectionComponent.nested.floats)");
      s.find("from Baz baz where 'b' in elements(baz.collectionComponent.nested.foos) and 1.0 in elements(baz.collectionComponent.nested.floats)");
    }

    s.find("from Foo foo join foo.foo where foo.foo in ('1','2','3')");
    if ( !(getDialect() instanceof HSQLDialect) ) s.find("from Foo foo left join foo.foo where foo.foo in ('1','2','3')");
    s.find("select foo.foo from Foo foo where foo.foo in ('1','2','3')");
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.