From: <one...@us...> - 2003-04-17 08:09:17
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv15041/hibernate/test Modified Files: FooBarTest.java Log Message: allow polymorphic embedded composite-id classes add a test for outer-join=true Index: FooBarTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/FooBarTest.java,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** FooBarTest.java 15 Apr 2003 09:32:59 -0000 1.54 --- FooBarTest.java 17 Apr 2003 08:09:13 -0000 1.55 *************** *** 59,62 **** --- 59,91 ---- } + public void testForceOuterJoin() throws Exception { + Session s = sessions.openSession(); + Glarch g = new Glarch(); + FooComponent fc = new FooComponent(); + fc.setGlarch(g); + FooProxy f = new Foo(); + FooProxy f2 = new Foo(); + f.setComponent(fc); + f.setFoo(f2); + s.save(f2); + Serializable id = s.save(f); + Serializable gid = s.getIdentifier( f.getComponent().getGlarch() ); + s.flush(); + s.connection().commit(); + s.close(); + + s = sessions.openSession(); + f = (FooProxy) s.load(Foo.class, id); + assertFalse( Hibernate.isInitialized(f) ); + assertTrue( Hibernate.isInitialized( f.getComponent().getGlarch() ) ); //outer-join="true" + assertFalse( Hibernate.isInitialized( f.getFoo() ) ); //outer-join="auto" + assertEquals( s.getIdentifier( f.getComponent().getGlarch() ), gid ); + s.delete(f); + s.delete( f.getFoo() ); + s.flush(); + s.connection().commit(); + s.close(); + } + public void testEmptyCollection() throws Exception { Session s = sessions.openSession(); |