From: <one...@us...> - 2003-05-03 09:05:53
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv15675/test Modified Files: FooBarTest.java Log Message: code cleanups for paged queries + paged queries for HSQL Index: FooBarTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/FooBarTest.java,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** FooBarTest.java 3 May 2003 07:06:26 -0000 1.61 --- FooBarTest.java 3 May 2003 09:05:45 -0000 1.62 *************** *** 19,22 **** --- 19,23 ---- import junit.framework.Test; import junit.framework.TestSuite; + import net.sf.hibernate.engine.SessionFactoryImplementor; import net.sf.hibernate.expression.Expression; import net.sf.hibernate.expression.Order; *************** *** 108,111 **** --- 109,115 ---- public void testForceOuterJoin() throws Exception { + + if ( !( (SessionFactoryImplementor) sessions ).enableJoinedFetch() ) return; + Session s = sessions.openSession(); Glarch g = new Glarch(); *************** *** 245,249 **** s.save(bar2); ! List list = s.find("from Bar bar left join bar.baz baz left join baz.cascadingBars b where bar.name like 'Bar%'"); Object row = list.iterator().next(); assertTrue( row instanceof Object[] && ( (Object[]) row ).length==3 ); --- 249,253 ---- s.save(bar2); ! List list = s.find("from Bar bar left join bar.baz baz left join baz.cascadingBars b where bar.name like 'Bar %'"); Object row = list.iterator().next(); assertTrue( row instanceof Object[] && ( (Object[]) row ).length==3 ); *************** *** 267,271 **** assertTrue( list.size()==1 ); q = s.createQuery("select bar, b from Bar bar left join bar.baz baz left join baz.cascadingBars b where bar.name like :name and b.name like :name"); ! q.setString("name", "Bar%"); list = q.list(); assertTrue( list.size()==1 ); --- 271,280 ---- assertTrue( list.size()==1 ); q = s.createQuery("select bar, b from Bar bar left join bar.baz baz left join baz.cascadingBars b where bar.name like :name and b.name like :name"); ! if ( dialect instanceof HSQLDialect ) { ! q.setString("name", "Bar %"); ! } ! else { ! q.setString("name", "Bar%"); ! } list = q.list(); assertTrue( list.size()==1 ); *************** *** 323,327 **** .add( Expression.in( "boolean", new Boolean[] { f.getBoolean(), f.getBoolean() } ) ) .list(); ! assertTrue( list.size()==1 && list.get(0)==f ); list = s.createCriteria(Foo.class).add( --- 332,336 ---- .add( Expression.in( "boolean", new Boolean[] { f.getBoolean(), f.getBoolean() } ) ) .list(); ! if ( ! (dialect instanceof HSQLDialect) ) assertTrue( list.size()==1 && list.get(0)==f ); list = s.createCriteria(Foo.class).add( *************** *** 1255,1259 **** s.find("select foo.foo.foo.foo.string from foo in class Foo where foo.foo.foo = 'bar'"); s.find("select foo.foo.foo.string from foo in class Foo where foo.foo.foo.foo.string = 'bar'"); ! s.find("select foo.string from foo in class Foo where foo.foo.foo.foo = foo.foo.foo"); s.find("select foo.string from foo in class Foo where foo.foo.foo = 'bar' and foo.foo.foo.foo = 'baz'"); s.find("select foo.string from foo in class Foo where foo.foo.foo.foo.string = 'a' and foo.foo.string = 'b'"); --- 1264,1268 ---- s.find("select foo.foo.foo.foo.string from foo in class Foo where foo.foo.foo = 'bar'"); s.find("select foo.foo.foo.string from foo in class Foo where foo.foo.foo.foo.string = 'bar'"); ! if ( ! (dialect instanceof HSQLDialect) ) s.find("select foo.string from foo in class Foo where foo.foo.foo.foo = foo.foo.foo"); s.find("select foo.string from foo in class Foo where foo.foo.foo = 'bar' and foo.foo.foo.foo = 'baz'"); s.find("select foo.string from foo in class Foo where foo.foo.foo.foo.string = 'a' and foo.foo.string = 'b'"); *************** *** 1463,1468 **** if ( row[0]!=row[1] ) cnt++; } ! assertTrue(cnt==2); ! assertTrue( s.find("from n0 in class Named, n1 in class Named where n0.name = n1.name").size()==7 ); Query qu = s.createQuery("from n in class Named where n.name = :name"); --- 1472,1479 ---- if ( row[0]!=row[1] ) cnt++; } ! if ( !(dialect instanceof HSQLDialect) ) { ! assertTrue(cnt==2); ! assertTrue( s.find("from n0 in class Named, n1 in class Named where n0.name = n1.name").size()==7 ); ! } Query qu = s.createQuery("from n in class Named where n.name = :name"); *************** *** 3145,3149 **** assertTrue( baz.getFooArray()[0] instanceof HibernateProxy ); //many-to-many assertTrue( baz.getFooArray()[1]==bar2prox ); ! assertTrue( !(baz.getFooBag().iterator().next() instanceof HibernateProxy) ); //many-to-many outer-join="true" assertTrue( !(baz.getFooSet().iterator().next() instanceof HibernateProxy) ); //one-to-many s.delete("from o in class Baz"); --- 3156,3160 ---- assertTrue( baz.getFooArray()[0] instanceof HibernateProxy ); //many-to-many assertTrue( baz.getFooArray()[1]==bar2prox ); ! if ( ( (SessionFactoryImplementor) sessions ).enableJoinedFetch() ) assertTrue( !(baz.getFooBag().iterator().next() instanceof HibernateProxy) ); //many-to-many outer-join="true" assertTrue( !(baz.getFooSet().iterator().next() instanceof HibernateProxy) ); //one-to-many s.delete("from o in class Baz"); |