Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/test In directory usw-pr-cvs1:/tmp/cvs-serv1018/hibernate/test Modified Files: FooBarTest.java MasterDetailTest.java MoreStuff.java Stuff.hbm.xml Stuff.java Log Message: improved handling of <key-many-to-many> in load process Index: FooBarTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/test/FooBarTest.java,v retrieving revision 1.218 retrieving revision 1.219 diff -C2 -d -r1.218 -r1.219 *** FooBarTest.java 7 Nov 2002 10:10:59 -0000 1.218 --- FooBarTest.java 7 Nov 2002 11:33:49 -0000 1.219 *************** *** 89,92 **** --- 89,96 ---- FooProxy foo = (FooProxy) s.load(Foo.class, id); s.load(more, more); + t.commit(); + s.close(); + s = sessions.openSession(); + t = s.beginTransaction(); Stuff stuff = new Stuff(); stuff.setFoo(foo); *************** *** 97,101 **** assertTrue( stuff.getMoreStuff().getName().equals("More Stuff") ); s.delete( stuff.getMoreStuff() ); ! s.delete(foo); t.commit(); s.close(); --- 101,105 ---- assertTrue( stuff.getMoreStuff().getName().equals("More Stuff") ); s.delete( stuff.getMoreStuff() ); ! s.delete("from foo in class Foo"); t.commit(); s.close(); Index: MasterDetailTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/test/MasterDetailTest.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** MasterDetailTest.java 7 Nov 2002 10:10:59 -0000 1.39 --- MasterDetailTest.java 7 Nov 2002 11:33:49 -0000 1.40 *************** *** 50,53 **** --- 50,63 ---- t.commit(); s.close(); + s = sessions.openSession(); + t = s.beginTransaction(); + s.find("from s in class Several"); + t.commit(); + s.close(); + s = sessions.openSession(); + t = s.beginTransaction(); + s.find("from s in class Single"); + t.commit(); + s.close(); } Index: MoreStuff.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/test/MoreStuff.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MoreStuff.java 7 Nov 2002 10:12:15 -0000 1.1 --- MoreStuff.java 7 Nov 2002 11:33:49 -0000 1.2 *************** *** 11,14 **** --- 11,22 ---- private Collection stuffs; private String name; + + public boolean equals(Object other) { + return ( (MoreStuff) other ).getIntId()==intId && ( (MoreStuff) other ).getStringId().equals(stringId); + } + + public int hashCode() { + return stringId.hashCode(); + } /** Index: Stuff.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/test/Stuff.hbm.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Stuff.hbm.xml 7 Nov 2002 10:10:59 -0000 1.4 --- Stuff.hbm.xml 7 Nov 2002 11:33:49 -0000 1.5 *************** *** 23,31 **** <key-property name="id"/> <key-many-to-one name="foo" class="cirrus.hibernate.test.Foo"/> ! </composite-id> ! <many-to-one name="moreStuff" class="cirrus.hibernate.test.MoreStuff"> <column name="moreInt"/> <column name="moreString"/> ! </many-to-one> <property name="property"/> </class> --- 23,31 ---- <key-property name="id"/> <key-many-to-one name="foo" class="cirrus.hibernate.test.Foo"/> ! <key-many-to-one name="moreStuff" class="cirrus.hibernate.test.MoreStuff"> <column name="moreInt"/> <column name="moreString"/> ! </key-many-to-one> ! </composite-id> <property name="property"/> </class> Index: Stuff.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/test/Stuff.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Stuff.java 7 Nov 2002 10:10:59 -0000 1.2 --- Stuff.java 7 Nov 2002 11:33:49 -0000 1.3 *************** *** 14,18 **** if ( ! (other instanceof Stuff) ) return false; Stuff otherStuff = (Stuff) other; ! return otherStuff.id==id && otherStuff.foo==foo && otherStuff.moreStuff==moreStuff; } --- 14,18 ---- if ( ! (other instanceof Stuff) ) return false; Stuff otherStuff = (Stuff) other; ! return otherStuff.getId()==id && otherStuff.getFoo().getKey().equals( foo.getKey() ) && otherStuff.getMoreStuff().equals(moreStuff); } |