Package org.hibernate.classic

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


    s.find("select count(*) from Foo foo where foo.foo.string in ('1','2','3') or foo.foo.long in (1,2,3)");
    s.find("select count(*) from Foo foo where foo.foo.string in ('1','2','3') group by foo.foo.long");

    s.find("from Foo foo1 left join foo1.foo foo2 left join foo2.foo where foo1.string is not null");
    s.find("from Foo foo1 left join foo1.foo.foo where foo1.string is not null");
    s.find("from Foo foo1 left join foo1.foo foo2 left join foo1.foo.foo foo3 where foo1.string is not null");

    s.find("select foo.formula from Foo foo where foo.formula > 0");

    int len = s.find("from Foo as foo join foo.foo as foo2 where foo2.id >'a' or foo2.id <'a'").size();
    assertTrue(len==2);
View Full Code Here


    s.find("from Foo foo1 left join foo1.foo foo2 left join foo2.foo where foo1.string is not null");
    s.find("from Foo foo1 left join foo1.foo.foo where foo1.string is not null");
    s.find("from Foo foo1 left join foo1.foo foo2 left join foo1.foo.foo foo3 where foo1.string is not null");

    s.find("select foo.formula from Foo foo where foo.formula > 0");

    int len = s.find("from Foo as foo join foo.foo as foo2 where foo2.id >'a' or foo2.id <'a'").size();
    assertTrue(len==2);

    s.delete("from Holder");
View Full Code Here

    s.find("from Foo foo1 left join foo1.foo.foo where foo1.string is not null");
    s.find("from Foo foo1 left join foo1.foo foo2 left join foo1.foo.foo foo3 where foo1.string is not null");

    s.find("select foo.formula from Foo foo where foo.formula > 0");

    int len = s.find("from Foo as foo join foo.foo as foo2 where foo2.id >'a' or foo2.id <'a'").size();
    assertTrue(len==2);

    s.delete("from Holder");
    txn.commit();
    s.close();
View Full Code Here

    txn = s.beginTransaction();
    baz = (Baz) s.createQuery("from Baz baz left outer join fetch baz.manyToAny").uniqueResult();
    assertTrue( Hibernate.isInitialized( baz.getManyToAny() ) );
    assertTrue( baz.getManyToAny().size()==2 );
    BarProxy barp = (BarProxy) baz.getManyToAny().get(0);
    s.find("from Baz baz join baz.manyToAny");
    assertTrue( s.find("select baz from Baz baz join baz.manyToAny a where index(a) = 0").size()==1 );

    FooProxy foop = (FooProxy) s.get( Foo.class, foo.getKey() );
    assertTrue( foop == baz.getManyToAny().get(1) );
View Full Code Here

    baz = (Baz) s.createQuery("from Baz baz left outer join fetch baz.manyToAny").uniqueResult();
    assertTrue( Hibernate.isInitialized( baz.getManyToAny() ) );
    assertTrue( baz.getManyToAny().size()==2 );
    BarProxy barp = (BarProxy) baz.getManyToAny().get(0);
    s.find("from Baz baz join baz.manyToAny");
    assertTrue( s.find("select baz from Baz baz join baz.manyToAny a where index(a) = 0").size()==1 );

    FooProxy foop = (FooProxy) s.get( Foo.class, foo.getKey() );
    assertTrue( foop == baz.getManyToAny().get(1) );

    barp.setBaz(baz);
View Full Code Here

    FooProxy foop = (FooProxy) s.get( Foo.class, foo.getKey() );
    assertTrue( foop == baz.getManyToAny().get(1) );

    barp.setBaz(baz);
    assertTrue( s.find("select bar from Bar bar where bar.baz.stringDateMap['now'] is not null").size()==1 );
    assertTrue( s.find("select bar from Bar bar join bar.baz b where b.stringDateMap['big bang'] < b.stringDateMap['now'] and b.stringDateMap['now'] is not null").size()==1 );
    assertTrue( s.find("select bar from Bar bar where bar.baz.stringDateMap['big bang'] < bar.baz.stringDateMap['now'] and bar.baz.stringDateMap['now'] is not null").size()==1 );

    list = s.find("select foo.string, foo.component, foo.id from Bar foo");
    assertTrue ( ( (FooComponent) ( (Object[]) list.get(0) )[1] ).getName().equals("foo") );
View Full Code Here

    FooProxy foop = (FooProxy) s.get( Foo.class, foo.getKey() );
    assertTrue( foop == baz.getManyToAny().get(1) );

    barp.setBaz(baz);
    assertTrue( s.find("select bar from Bar bar where bar.baz.stringDateMap['now'] is not null").size()==1 );
    assertTrue( s.find("select bar from Bar bar join bar.baz b where b.stringDateMap['big bang'] < b.stringDateMap['now'] and b.stringDateMap['now'] is not null").size()==1 );
    assertTrue( s.find("select bar from Bar bar where bar.baz.stringDateMap['big bang'] < bar.baz.stringDateMap['now'] and bar.baz.stringDateMap['now'] is not null").size()==1 );

    list = s.find("select foo.string, foo.component, foo.id from Bar foo");
    assertTrue ( ( (FooComponent) ( (Object[]) list.get(0) )[1] ).getName().equals("foo") );
    list = s.find("select elements(baz.components) from Baz baz");
View Full Code Here

    assertTrue( foop == baz.getManyToAny().get(1) );

    barp.setBaz(baz);
    assertTrue( s.find("select bar from Bar bar where bar.baz.stringDateMap['now'] is not null").size()==1 );
    assertTrue( s.find("select bar from Bar bar join bar.baz b where b.stringDateMap['big bang'] < b.stringDateMap['now'] and b.stringDateMap['now'] is not null").size()==1 );
    assertTrue( s.find("select bar from Bar bar where bar.baz.stringDateMap['big bang'] < bar.baz.stringDateMap['now'] and bar.baz.stringDateMap['now'] is not null").size()==1 );

    list = s.find("select foo.string, foo.component, foo.id from Bar foo");
    assertTrue ( ( (FooComponent) ( (Object[]) list.get(0) )[1] ).getName().equals("foo") );
    list = s.find("select elements(baz.components) from Baz baz");
    assertTrue( list.size()==2 );
View Full Code Here

    barp.setBaz(baz);
    assertTrue( s.find("select bar from Bar bar where bar.baz.stringDateMap['now'] is not null").size()==1 );
    assertTrue( s.find("select bar from Bar bar join bar.baz b where b.stringDateMap['big bang'] < b.stringDateMap['now'] and b.stringDateMap['now'] is not null").size()==1 );
    assertTrue( s.find("select bar from Bar bar where bar.baz.stringDateMap['big bang'] < bar.baz.stringDateMap['now'] and bar.baz.stringDateMap['now'] is not null").size()==1 );

    list = s.find("select foo.string, foo.component, foo.id from Bar foo");
    assertTrue ( ( (FooComponent) ( (Object[]) list.get(0) )[1] ).getName().equals("foo") );
    list = s.find("select elements(baz.components) from Baz baz");
    assertTrue( list.size()==2 );
    list = s.find("select bc.name from Baz baz join baz.components bc");
    assertTrue( list.size()==2 );
View Full Code Here

    assertTrue( s.find("select bar from Bar bar join bar.baz b where b.stringDateMap['big bang'] < b.stringDateMap['now'] and b.stringDateMap['now'] is not null").size()==1 );
    assertTrue( s.find("select bar from Bar bar where bar.baz.stringDateMap['big bang'] < bar.baz.stringDateMap['now'] and bar.baz.stringDateMap['now'] is not null").size()==1 );

    list = s.find("select foo.string, foo.component, foo.id from Bar foo");
    assertTrue ( ( (FooComponent) ( (Object[]) list.get(0) )[1] ).getName().equals("foo") );
    list = s.find("select elements(baz.components) from Baz baz");
    assertTrue( list.size()==2 );
    list = s.find("select bc.name from Baz baz join baz.components bc");
    assertTrue( list.size()==2 );
    //list = s.find("select bc from Baz baz join baz.components bc");
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.