Package org.hibernate.classic

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


    t.commit();
    s.close();

    s = openSession();
    t = s.beginTransaction();
    list = s.find("select m from Master m1, Master m left join fetch m.details where m.name=m1.name");
    assertTrue( Hibernate.isInitialized( ( (Master) list.get(0) ).getDetails() ) );
    dt = (Detail) s.load(Detail.class, dtid);
    assertTrue( ( (Master) list.get(0) ).getDetails().contains(dt) );
    t.commit();
    s.close();
View Full Code Here


    t.commit();
    s.close();

    s = openSession();
    t = s.beginTransaction();
    list = s.find("select m, m1.name from Master m1, Master m left join fetch m.details where m.name=m1.name");
    assertTrue( Hibernate.isInitialized( ( (Master) ( (Object[]) list.get(0) )[0] ).getDetails() ) );
    dt = (Detail) s.load(Detail.class, dtid);
    assertTrue( ( (Master) ( (Object[]) list.get(0) )[0] ).getDetails().contains(dt) );
    //list = s.find("select m from Master m, Master m2 left join fetch m.details");
// depracted syntax
View Full Code Here

    s = openSession();
    Foo foo2 = new Foo();
    foo2.setJoinedProp("foo");
    s.save(foo2);
    s.find("select foo.id from Foo foo where foo.joinedProp = 'foo'");
    assertNull( s.get(Foo.class, fid) );
    s.delete(foo2);
    s.flush();
    s.connection().commit();
    s.close();
View Full Code Here

    s = openSession();
    h = (Holder) s.load(Holder.class, hid);
    assertEquals( h.getName(), "foo");
    assertEquals( h.getOtherHolder().getName(), "bar");
    Object[] res = (Object[]) s.find("from Holder h join h.otherHolder oh where h.otherHolder.name = 'bar'").get(0);
    assertTrue( res[0]==h );
    q = (Qux) s.get(Qux.class, qid);
    assertTrue( q.getHolder() == h.getOtherHolder() );
    s.delete(h);
    s.delete(q);
View Full Code Here

    s = openSession();
    //s.find("from Baz baz where baz.fooSet.string = 'foo'");
    //s.find("from Baz baz where baz.fooArray.string = 'foo'");
    //s.find("from Baz baz where baz.fooSet.foo.string = 'foo'");
    //s.find("from Baz baz join baz.fooSet.foo foo where foo.string = 'foo'");
    s.find("from Baz baz join baz.fooSet foo join foo.foo.foo foo2 where foo2.string = 'foo'");
    s.find("from Baz baz join baz.fooArray foo join foo.foo.foo foo2 where foo2.string = 'foo'");
    s.find("from Baz baz join baz.stringDateMap date where index(date) = 'foo'");
    s.find("from Baz baz join baz.topGlarchez g where index(g) = 'A'");
    s.find("select index(g) from Baz baz join baz.topGlarchez g");
View Full Code Here

    //s.find("from Baz baz where baz.fooSet.string = 'foo'");
    //s.find("from Baz baz where baz.fooArray.string = 'foo'");
    //s.find("from Baz baz where baz.fooSet.foo.string = 'foo'");
    //s.find("from Baz baz join baz.fooSet.foo foo where foo.string = 'foo'");
    s.find("from Baz baz join baz.fooSet foo join foo.foo.foo foo2 where foo2.string = 'foo'");
    s.find("from Baz baz join baz.fooArray foo join foo.foo.foo foo2 where foo2.string = 'foo'");
    s.find("from Baz baz join baz.stringDateMap date where index(date) = 'foo'");
    s.find("from Baz baz join baz.topGlarchez g where index(g) = 'A'");
    s.find("select index(g) from Baz baz join baz.topGlarchez g");

    assertTrue( s.find("from Baz baz left join baz.stringSet").size()==3 );
View Full Code Here

    //s.find("from Baz baz where baz.fooArray.string = 'foo'");
    //s.find("from Baz baz where baz.fooSet.foo.string = 'foo'");
    //s.find("from Baz baz join baz.fooSet.foo foo where foo.string = 'foo'");
    s.find("from Baz baz join baz.fooSet foo join foo.foo.foo foo2 where foo2.string = 'foo'");
    s.find("from Baz baz join baz.fooArray foo join foo.foo.foo foo2 where foo2.string = 'foo'");
    s.find("from Baz baz join baz.stringDateMap date where index(date) = 'foo'");
    s.find("from Baz baz join baz.topGlarchez g where index(g) = 'A'");
    s.find("select index(g) from Baz baz join baz.topGlarchez g");

    assertTrue( s.find("from Baz baz left join baz.stringSet").size()==3 );
    baz = (Baz) s.find("from Baz baz join baz.stringSet str where str='foo'").get(0);
View Full Code Here

    //s.find("from Baz baz where baz.fooSet.foo.string = 'foo'");
    //s.find("from Baz baz join baz.fooSet.foo foo where foo.string = 'foo'");
    s.find("from Baz baz join baz.fooSet foo join foo.foo.foo foo2 where foo2.string = 'foo'");
    s.find("from Baz baz join baz.fooArray foo join foo.foo.foo foo2 where foo2.string = 'foo'");
    s.find("from Baz baz join baz.stringDateMap date where index(date) = 'foo'");
    s.find("from Baz baz join baz.topGlarchez g where index(g) = 'A'");
    s.find("select index(g) from Baz baz join baz.topGlarchez g");

    assertTrue( s.find("from Baz baz left join baz.stringSet").size()==3 );
    baz = (Baz) s.find("from Baz baz join baz.stringSet str where str='foo'").get(0);
    assertTrue( !Hibernate.isInitialized( baz.getStringSet() ) );
View Full Code Here

    //s.find("from Baz baz join baz.fooSet.foo foo where foo.string = 'foo'");
    s.find("from Baz baz join baz.fooSet foo join foo.foo.foo foo2 where foo2.string = 'foo'");
    s.find("from Baz baz join baz.fooArray foo join foo.foo.foo foo2 where foo2.string = 'foo'");
    s.find("from Baz baz join baz.stringDateMap date where index(date) = 'foo'");
    s.find("from Baz baz join baz.topGlarchez g where index(g) = 'A'");
    s.find("select index(g) from Baz baz join baz.topGlarchez g");

    assertTrue( s.find("from Baz baz left join baz.stringSet").size()==3 );
    baz = (Baz) s.find("from Baz baz join baz.stringSet str where str='foo'").get(0);
    assertTrue( !Hibernate.isInitialized( baz.getStringSet() ) );
    baz = (Baz) s.find("from Baz baz left join fetch baz.stringSet").get(0);
View Full Code Here

    s.find("from Baz baz join baz.fooArray foo join foo.foo.foo foo2 where foo2.string = 'foo'");
    s.find("from Baz baz join baz.stringDateMap date where index(date) = 'foo'");
    s.find("from Baz baz join baz.topGlarchez g where index(g) = 'A'");
    s.find("select index(g) from Baz baz join baz.topGlarchez g");

    assertTrue( s.find("from Baz baz left join baz.stringSet").size()==3 );
    baz = (Baz) s.find("from Baz baz join baz.stringSet str where str='foo'").get(0);
    assertTrue( !Hibernate.isInitialized( baz.getStringSet() ) );
    baz = (Baz) s.find("from Baz baz left join fetch baz.stringSet").get(0);
    assertTrue( Hibernate.isInitialized( baz.getStringSet() ) );
    assertTrue( s.find("from Baz baz join baz.stringSet string where string='foo'").size()==1 );
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.