From: <ste...@us...> - 2006-02-08 22:25:51
|
Update of /cvsroot/hibernate/Hibernate3/test/org/hibernate/test/legacy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17574/test/org/hibernate/test/legacy Modified Files: FooBarTest.java FumTest.java MasterDetailTest.java SQLLoaderTest.java Log Message: HHH-1410: no auto-flush outside transactions Index: FooBarTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/test/org/hibernate/test/legacy/FooBarTest.java,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- FooBarTest.java 10 Jan 2006 16:13:47 -0000 1.36 +++ FooBarTest.java 8 Feb 2006 22:25:37 -0000 1.37 @@ -333,6 +333,7 @@ public void testQuery() throws Exception { Session s = openSession(); + Transaction txn = s.beginTransaction(); Foo foo = new Foo(); s.save(foo); Foo foo2 = new Foo(); @@ -665,11 +666,11 @@ assertTrue(len==2); s.delete("from Holder"); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); s = openSession(); + 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 ); @@ -699,8 +700,7 @@ s.delete(baz); s.delete( foop.getFoo() ); s.delete(foop); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); } @@ -1490,6 +1490,7 @@ public void testLimit() throws Exception { Session s = openSession(); + Transaction txn = s.beginTransaction(); for ( int i=0; i<10; i++ ) s.save( new Foo() ); Iterator iter = s.createQuery("from Foo foo") .setMaxResults(4) @@ -1523,8 +1524,7 @@ } assertTrue(count==3); assertTrue( s.delete("from Foo foo")==10 ); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); } @@ -1589,7 +1589,9 @@ baz.setCascadingBars( new HashSet() ); baz.getCascadingBars().add(bar); bar.setBaz(baz); + Session s = openSession(); + Transaction txn = s.beginTransaction(); s.save(baz); s.save(bar2); @@ -1645,8 +1647,7 @@ s.delete(baz); s.delete(bar2); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); } @@ -1756,6 +1757,7 @@ public void testFindByCriteria() throws Exception { if ( getDialect() instanceof DB2Dialect ) return; Session s = openSession(); + Transaction txn = s.beginTransaction(); Foo f = new Foo(); s.save(f); s.flush(); @@ -1844,11 +1846,11 @@ f.setFoo( new Foo() ); s.save( f.getFoo() ); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); s = openSession(); + txn = s.beginTransaction(); list = s.createCriteria(Foo.class) .add( Expression.eq( "integer", f.getInteger() ) ) .add( Expression.like( "string", f.getString() ) ) @@ -1873,8 +1875,7 @@ s.delete( f.getFoo() ); s.delete(f); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); } @@ -2180,6 +2181,7 @@ public void testNewFlushing() throws Exception { Session s = openSession(); + Transaction txn = s.beginTransaction(); Baz baz = new Baz(); baz.setDefaults(); s.save(baz); @@ -2229,14 +2231,13 @@ assertTrue( iter.hasNext() ); s.delete(baz); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); } public void testPersistCollections() throws Exception { - Session s = openSession(); + Transaction txn = s.beginTransaction(); assertTrue( ( (Integer) s.iterate("select count(*) from Bar").next() ).intValue()==0 ); assertTrue( s.iterate("select count(*) from Bar b").next().equals( new Integer(0) ) ); assertFalse( s.iterate("from Glarch g").hasNext() ); @@ -2253,11 +2254,11 @@ sgm.put( "b", new Glarch() ); baz.setStringGlarchMap(sgm); //System.out.println( s.print(baz) ); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); s = openSession(); + txn = s.beginTransaction(); assertTrue( ( (Integer) s.iterate("select count(*) from Bar").next() ).intValue()==1 ); baz = (Baz) ( (Object[]) s.find("select baz, baz from Baz baz").get(0) )[1]; assertTrue( baz.getCascadingBars().size()==1 ); @@ -2290,11 +2291,11 @@ List list = s.find("select foo from Baz baz join baz.fooSet foo"); assertTrue( "association.elements find", list.size()==1 ); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); s = openSession(); + txn = s.beginTransaction(); assertTrue( ( (Integer) s.iterate("select count(*) from Bar").next() ).intValue()==1 ); baz = (Baz) s.find("select baz from Baz baz order by baz").get(0); assertTrue( "collection of custom types - added element", baz.getCustoms().size()==4 && baz.getCustoms().get(0)!=null ); @@ -2310,10 +2311,11 @@ baz.getStringSet().add("two"); baz.getStringSet().add("one"); baz.getBag().add("three"); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); + s = openSession(); + txn = s.beginTransaction(); baz = (Baz) s.find("select baz from Baz baz order by baz").get(0); assertTrue( baz.getStringSet().size()==2 ); assertTrue( baz.getStringSet().first().equals("one") ); @@ -2321,11 +2323,11 @@ assertTrue( baz.getBag().size()==5 ); baz.getStringSet().remove("two"); baz.getBag().remove("duplicate"); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); s = openSession(); + txn = s.beginTransaction(); assertTrue( ( (Integer) s.iterate("select count(*) from Bar").next() ).intValue()==1 ); baz = (Baz) s.load(Baz.class, baz.getCode()); assertTrue( baz.getCascadingBars().size()==1 ); @@ -2351,22 +2353,23 @@ map = new HashMap(); map.put(bar, g); baz.setGlarchToFoo(map); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); s = openSession(); + txn = s.beginTransaction(); baz = (Baz) s.find("select baz from Baz baz order by baz").get(0); assertTrue( baz.getCascadingBars().size()==1 ); Session s2 = openSession(); + Transaction txn2 = s2.beginTransaction(); assertTrue( ( (Integer) s2.iterate("select count(*) from Bar").next() ).intValue()==3 ); Baz baz2 = (Baz) s2.find("select baz from Baz baz order by baz").get(0); Object o = baz2.getFooComponentToFoo().get( new FooComponent("name", 123, null, null) ); assertTrue( o==baz2.getFooComponentToFoo().get( new FooComponent("nameName", 12, null, null) ) && o!=null ); - s2.connection().commit(); + txn2.commit(); s2.close(); assertTrue( Hibernate.isInitialized( baz.getFooToGlarch() ) ); @@ -2391,24 +2394,24 @@ g = (GlarchProxy) baz.getTopGlarchez().get( new Character('G') ); baz.getTopGlarchez().put( new Character('H'), g ); baz.getTopGlarchez().put( new Character('G'), g2 ); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); s = openSession(); + txn = s.beginTransaction(); baz = (Baz) s.load(Baz.class, baz.getCode()); assertTrue( baz.getTopGlarchez().size()==2 ); assertTrue( baz.getCascadingBars().size()==1 ); - s.connection().commit(); + txn.commit(); s.close(); s = openSession(); + txn = s.beginTransaction(); assertTrue( ( (Integer) s.iterate("select count(*) from Bar").next() ).intValue()==3 ); baz = (Baz) s.find("select baz from Baz baz order by baz").get(0); assertTrue( baz.getTopGlarchez().size()==2 ); assertTrue( baz.getCascadingBars().size()==1 ); - - s.connection().commit(); + txn.commit(); s.disconnect(); @@ -2416,6 +2419,7 @@ s.close(); s2.reconnect(); + txn2 = s2.beginTransaction(); baz = (Baz) s2.load(Baz.class, baz.getCode()); assertTrue( ( (Integer) s2.iterate("select count(*) from Bar").next() ).intValue()==3 ); s2.delete(baz); @@ -2433,9 +2437,7 @@ s2.load( Qux.class, new Long(666) ); //nonexistent assertTrue( s2.delete("from Glarch g")==1 ); - - s2.flush(); - s2.connection().commit(); + txn2.commit(); s2.disconnect(); @@ -2681,6 +2683,7 @@ public void testFind() throws Exception { Session s = openSession(); + Transaction txn = s.beginTransaction(); Bar bar = new Bar(); s.save(bar); @@ -2707,11 +2710,11 @@ assertTrue( "select from a subclass", list2.size()==1); Trivial t = new Trivial(); s.save(t); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); s = openSession(); + txn = s.beginTransaction(); list1 = s.find("from Foo foo where foo.string='foo bar'"); assertTrue( "find size", list1.size()==1 ); // There is an interbase bug that causes null integers to return as 0, also numeric precision is <= 15 @@ -2732,8 +2735,7 @@ } list2 = s.find("from Foo foo"); assertTrue( "find deleted", list2.size()==0); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); } @@ -2971,6 +2973,7 @@ public void testVersioning() throws Exception { Session s = openSession(); + Transaction txn = s.beginTransaction(); GlarchProxy g = new Glarch(); s.save(g); GlarchProxy g2 = new Glarch(); @@ -2978,13 +2981,13 @@ Serializable gid = s.getIdentifier(g); Serializable g2id = s.getIdentifier(g2); g.setName("glarch"); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); getSessions().evict(Glarch.class); s = openSession(); + txn = s.beginTransaction(); g = (GlarchProxy) s.load( Glarch.class, gid ); s.lock(g, LockMode.UPGRADE); g2 = (GlarchProxy) s.load( Glarch.class, g2id ); @@ -2997,13 +3000,13 @@ s.find("from Glarch g where g.version=2").size()==1 ); g.setName("bar"); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); getSessions().evict(Glarch.class); s = openSession(); + txn = s.beginTransaction(); g = (GlarchProxy) s.load( Glarch.class, gid ); g2 = (GlarchProxy) s.load( Glarch.class, g2id ); assertTrue( "version", g.getVersion()==3 ); @@ -3013,8 +3016,7 @@ g2.setNext(g); s.delete(g2); s.delete(g); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); } @@ -3174,6 +3176,7 @@ //Non polymorphic class (there is an implementation optimization //being tested here) Session s = openSession(); + Transaction txn = s.beginTransaction(); GlarchProxy last = new Glarch(); s.save(last); last.setOrder( (short) 0 ); @@ -3190,32 +3193,32 @@ } List list = s.find("from Glarch g"); assertTrue( "recursive find", list.size()==6 ); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); s = openSession(); + txn = s.beginTransaction(); list = s.find("from Glarch g"); assertTrue( "recursive iter", list.size()==6 ); list = s.find("from Glarch g where g.next is not null"); assertTrue( "recursive iter", list.size()==5 ); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); s = openSession(); + txn = s.beginTransaction(); iter = s.iterate("from Glarch g order by g.order asc"); while ( iter.hasNext() ) { GlarchProxy g = (GlarchProxy) iter.next(); assertTrue( "not null", g!=null ); iter.remove(); } - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); //Same thing but using polymorphic class (no optimisation possible): s = openSession(); + txn = s.beginTransaction(); FooProxy flast = new Bar(); s.save(flast); flast.setString( "foo0" ); @@ -3232,36 +3235,36 @@ } list = s.find("from Foo foo"); assertTrue( "recursive find", list.size()==6 ); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); s = openSession(); + txn = s.beginTransaction(); list = s.find("from Foo foo"); assertTrue( "recursive iter", list.size()==6 ); iter = list.iterator(); while ( iter.hasNext() ) { assertTrue( "polymorphic recursive load", iter.next() instanceof BarProxy ); } - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); s = openSession(); + txn = s.beginTransaction(); iter = s.iterate("from Foo foo order by foo.string asc"); while ( iter.hasNext() ) { BarProxy bar = (BarProxy) iter.next(); assertTrue( "not null", bar!=null ); iter.remove(); } - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); } public void testScrollableIterator() throws Exception { if ( getDialect() instanceof DB2Dialect || getDialect() instanceof OracleDialect || getDialect() instanceof SybaseDialect || getDialect() instanceof HSQLDialect ) { Session s = openSession(); + Transaction txn = s.beginTransaction(); s.save( new Foo() ); s.save( new Foo() ); s.save( new Foo() ); @@ -3290,10 +3293,11 @@ assertTrue( iter.last() ); assertTrue( iter.get(0)==f4 ); assertTrue( iter.previous() ); - s.connection().commit(); + txn.commit(); s.close(); s = openSession(); + txn = s.beginTransaction(); query = s.createQuery("select f, f.integer from Foo f"); assertTrue( query.getReturnTypes().length==2 ); iter = query.scroll(); @@ -3322,13 +3326,14 @@ assertTrue( s.delete("from Foo")==4 ); s.flush(); assertTrue( s.find("from java.lang.Object").size()==0 ); - s.connection().commit(); + txn.commit(); s.close(); } } public void testMultiColumnQueries() throws Exception { Session s = openSession(); + Transaction txn = s.beginTransaction(); Foo foo = new Foo(); s.save(foo); Foo foo1 = new Foo(); @@ -3363,11 +3368,11 @@ row = (Object[]) l.get(0); assertTrue( "multi-column find", row[0]==foo && row[1]==foo.getFoo() ); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); s = openSession(); + txn = s.beginTransaction(); Iterator iter = s.iterate("select parent, child from Foo parent, Foo child where parent.foo = child and parent.string='a string'"); int deletions=0; while ( iter.hasNext() ) { @@ -3377,8 +3382,7 @@ deletions++; } assertTrue("multi-column iterate", deletions==1); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); } @@ -3623,15 +3627,18 @@ public void testComponents() throws Exception { Session s = openSession(); + Transaction txn = s.beginTransaction(); Foo foo = new Foo(); foo.setComponent( new FooComponent("foo", 69, null, new FooComponent("bar", 96, null, null) ) ); s.save(foo); foo.getComponent().setName("IFA"); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); + foo.setComponent(null); + s = openSession(); + txn = s.beginTransaction(); s.load( foo, foo.getKey() ); assertTrue( "save components", @@ -3640,11 +3647,13 @@ ); assertTrue( "cascade save via component", foo.getComponent().getGlarch()!=null); foo.getComponent().getSubcomponent().setName("baz"); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); + foo.setComponent(null); + s = openSession(); + txn = s.beginTransaction(); s.load( foo, foo.getKey() ); assertTrue( "update components", @@ -3652,18 +3661,17 @@ foo.getComponent().getSubcomponent().getName().equals("baz") ); s.delete(foo); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); s = openSession(); + txn = s.beginTransaction(); foo = new Foo(); s.save(foo); foo.setCustom( new String[] { "one", "two" } ); assertTrue( s.find("from Foo foo where foo.custom.s1 = 'one'").get(0)==foo ); s.delete(foo); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); } @@ -4093,14 +4101,17 @@ public void testAutoFlush() throws Exception { Session s = openSession(); + Transaction txn = s.beginTransaction(); FooProxy foo = new Foo(); s.save(foo); assertTrue( "autoflush create", s.find("from Foo foo").size()==1 ); foo.setChar( new Character('X') ); assertTrue( "autoflush update", s.find("from Foo foo where foo.char='X'").size()==1 ); - s.connection().commit(); + txn.commit(); s.close(); + s = openSession(); + txn = s.beginTransaction(); foo = (FooProxy) s.load( Foo.class, foo.getKey() ); //s.update( new Foo(), foo.getKey() ); //assertTrue( s.find("from Foo foo where not foo.char='X'").size()==1, "autoflush update" ); @@ -4112,7 +4123,7 @@ } s.delete(foo); assertTrue( "autoflush delete", s.find("from Foo foo").size()==0 ); - s.connection().commit(); + txn.commit(); s.close(); } @@ -4257,6 +4268,7 @@ public void testComplicatedQuery() throws Exception { Session s = openSession(); + Transaction txn = s.beginTransaction(); Foo foo = new Foo(); Serializable id = s.save(foo); assertTrue(id!=null); @@ -4270,8 +4282,7 @@ s.iterate("from Foo foo where foo.dependent.qux.foo.string = 'foo2'").hasNext() ); s.delete(foo); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); } @@ -4601,6 +4612,7 @@ public void testPSCache() throws Exception { Session s = openSession(); + Transaction txn = s.beginTransaction(); for ( int i=0; i<10; i++ ) s.save( new Foo() ); Query q = s.createQuery("from Foo"); q.setMaxResults(2); @@ -4614,15 +4626,17 @@ assertTrue( q.list().size()==3 ); q = s.createQuery("from Foo"); assertTrue( q.list().size()==10 ); - s.connection().commit(); + txn.commit(); s.close(); + s = openSession(); + txn = s.beginTransaction(); q = s.createQuery("from Foo"); assertTrue( q.list().size()==10 ); q.setMaxResults(5); assertTrue( q.list().size()==5 ); s.delete("from Foo"); - s.connection().commit(); + txn.commit(); s.close(); } Index: FumTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/test/org/hibernate/test/legacy/FumTest.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- FumTest.java 21 Dec 2005 13:22:50 -0000 1.13 +++ FumTest.java 8 Feb 2006 22:25:37 -0000 1.14 @@ -90,6 +90,7 @@ public void testCriteria() throws Exception { Session s = openSession(); + Transaction txn = s.beginTransaction(); Fum fum = new Fum( fumKey("fum") ); fum.setFo( new Fum( fumKey("fo") ) ); fum.setFum("fo fee fi"); @@ -155,11 +156,11 @@ .add( Expression.eqProperty("fr.id.short", "id.short") ) .list(); assertTrue( list.size()==1 && list.get(0)==fum ); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); s = openSession(); + txn = s.beginTransaction(); base = s.createCriteria(Fum.class) .add( Expression.like("fum", "f%") ); base.createCriteria("fo") @@ -172,8 +173,7 @@ s.delete( fum.getFo() ); Iterator iter = fum.getFriends().iterator(); while ( iter.hasNext() ) s.delete( iter.next() ); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); } @@ -246,6 +246,7 @@ public void testListIdentifiers() throws Exception { Session s = openSession(); + Transaction txn = s.beginTransaction(); Fum fum = new Fum( fumKey("fum") ); fum.setFum("fo fee fi"); s.save(fum); @@ -264,8 +265,7 @@ s.delete( s.load(Fum.class, (Serializable) list.get(0) ) ); s.delete( s.load(Fum.class, (Serializable) list.get(1) ) ); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); } @@ -303,15 +303,16 @@ public void testCompositeID() throws Exception { Session s = openSession(); + Transaction txn = s.beginTransaction(); Fum fum = new Fum( fumKey("fum") ); fum.setFum("fee fi fo"); s.save(fum); assertTrue( "load by composite key", fum==s.load( Fum.class, fumKey("fum") ) ); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); s = openSession(); + txn = s.beginTransaction(); fum = (Fum) s.load( Fum.class, fumKey("fum"), LockMode.UPGRADE ); assertTrue( "load by composite key", fum!=null ); @@ -328,11 +329,11 @@ s.find("select fum from Fum fum where fum.fum='fee fi fo'").get(0)==fum ); fum.setFo(null); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); s = openSession(); + txn = s.beginTransaction(); Iterator iter = s.iterate("from Fum fum where not fum.fum='FRIEND'"); int i = 0; while ( iter.hasNext() ) { @@ -342,28 +343,28 @@ i++; } assertTrue( "iterate on composite key", i==2 ); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); } public void testCompositeIDOneToOne() throws Exception { Session s = openSession(); + Transaction txn = s.beginTransaction(); Fum fum = new Fum( fumKey("fum") ); fum.setFum("fee fi fo"); //s.save(fum); Fumm fumm = new Fumm(); fumm.setFum(fum); s.save(fumm); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); + s = openSession(); + txn = s.beginTransaction(); fumm = (Fumm) s.load( Fumm.class, fumKey("fum") ); //s.delete( fumm.getFum() ); s.delete(fumm); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); } Index: MasterDetailTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/test/org/hibernate/test/legacy/MasterDetailTest.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- MasterDetailTest.java 21 Dec 2005 13:22:50 -0000 1.15 +++ MasterDetailTest.java 8 Feb 2006 22:25:37 -0000 1.16 @@ -675,8 +675,8 @@ } public void testMultiLevelCascade() throws Exception { - Session s = openSession(); + Transaction txn = s.beginTransaction(); Detail detail = new Detail(); SubDetail subdetail = new SubDetail(); Master m = new Master(); @@ -688,18 +688,18 @@ detail.setSubDetails( new HashSet() ); detail.getSubDetails().add(subdetail); Serializable mid = s.save(m); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); + s = openSession(); + txn = s.beginTransaction(); m = (Master) s.load( Master.class, mid ); assertTrue( ( (Detail) m.getMoreDetails().iterator().next() ).getSubDetails().size()!=0 ); s.delete(m); assertTrue( s.find("from SubDetail").size()==0 ); assertTrue( s.find("from Detail d").size()==0 ); s.delete( s.load(Master.class, m0id) ); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); } @@ -1116,6 +1116,7 @@ public void testPolymorphicCriteria() throws Exception { Session s = openSession(); + Transaction txn = s.beginTransaction(); Category f = new Category(); Single b = new Single(); b.setId("asdfa"); @@ -1127,8 +1128,7 @@ assertTrue( list.contains(f) && list.contains(b) ); s.delete(f); s.delete(b); - s.flush(); - s.connection().commit(); + txn.commit(); s.close(); } Index: SQLLoaderTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/test/org/hibernate/test/legacy/SQLLoaderTest.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- SQLLoaderTest.java 11 Jan 2006 18:50:33 -0000 1.23 +++ SQLLoaderTest.java 8 Feb 2006 22:25:37 -0000 1.24 @@ -12,6 +12,7 @@ import org.hibernate.HibernateException; import org.hibernate.Query; +import org.hibernate.Transaction; import org.hibernate.classic.Session; import org.hibernate.dialect.HSQLDialect; import org.hibernate.dialect.MySQLDialect; @@ -33,6 +34,7 @@ public void testTS() throws Exception { if (getDialect() instanceof Oracle9Dialect) return; Session session = openSession(); + Transaction txn = session.beginTransaction(); Simple sim = new Simple(); sim.setDate( new Date() ); session.save( sim, new Long(1) ); @@ -40,8 +42,7 @@ q.setTimestamp( 0, sim.getDate() ); assertTrue ( q.list().size()==1 ); session.delete(sim); - session.flush(); - session.connection().commit(); + txn.commit(); session.close(); } @@ -600,8 +601,8 @@ } - /** @issue HHH-21 */ public void testCompositeIdId() throws HibernateException, SQLException { + // issue HHH-21 Session s = openSession(); CompositeIdId id = new CompositeIdId(); |