From: <one...@us...> - 2003-04-02 13:10:50
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv2791/hibernate/test Modified Files: Baz.hbm.xml Container.hbm.xml FooBar.hbm.xml Glarch.hbm.xml MasterDetailTest.java Multi.hbm.xml ParentChildTest.java Added Files: W.java WZ.hbm.xml Z.java Log Message: fixed a problem where an (incorrect) SQL UPDATE was issued when update() was called on an object with no updateable properties --- NEW FILE: W.java --- package net.sf.hibernate.test; import java.util.Set; public class W { private long id; private Set zeds; /** * */ public W() { super(); // TODO Auto-generated constructor stub } /** * @return */ public long getId() { return id; } /** * @return */ public Set getZeds() { return zeds; } /** * @param l */ public void setId(long l) { id = l; } /** * @param set */ public void setZeds(Set set) { zeds = set; } } --- NEW FILE: WZ.hbm.xml --- <?xml version="1.0"?> <!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" > <hibernate-mapping> <class name="net.sf.hibernate.test.Z"> <id name="id" unsaved-value="0"> <generator class="hilo"/> </id> <many-to-one name="w" cascade="save-update" class="net.sf.hibernate.test.W" insert="true" update="false" not-null="true"/> </class> <class name="net.sf.hibernate.test.W" discriminator-value="0" proxy="net.sf.hibernate.test.Z"> <id name="id" unsaved-value="0"> <generator class="hilo"/> </id> <!--<set name="zeds" lazy="true"> <key column="w"/> <one-to-many class="net.sf.hibernate.test.Z"/> </set>--> </class> </hibernate-mapping> --- NEW FILE: Z.java --- package net.sf.hibernate.test; public class Z { private long id; private W w; /** * */ public Z() { super(); // TODO Auto-generated constructor stub } /** * @return */ public long getId() { return id; } /** * @return */ public W getW() { return w; } /** * @param l */ public void setId(long l) { id = l; } /** * @param w */ public void setW(W w) { this.w = w; } } Index: Baz.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/Baz.hbm.xml,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Baz.hbm.xml 29 Mar 2003 07:36:22 -0000 1.14 --- Baz.hbm.xml 2 Apr 2003 13:10:37 -0000 1.15 *************** *** 99,103 **** <array name="fooArray" element-class="net.sf.hibernate.test.FooProxy" where="i<8"> ! <!--<jcs-cache usage="read-write"/>--> <key column="id_" /> <index column="i"/> --- 99,103 ---- <array name="fooArray" element-class="net.sf.hibernate.test.FooProxy" where="i<8"> ! <jcs-cache usage="read-write"/> <key column="id_" /> <index column="i"/> *************** *** 134,138 **** <list name="topComponents" table="topcomponents"> ! <!--<jcs-cache usage="read-write"/>--> <key column="id_"/> <index column="i"/> --- 134,138 ---- <list name="topComponents" table="topcomponents"> ! <jcs-cache usage="read-write"/> <key column="id_"/> <index column="i"/> Index: Container.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/Container.hbm.xml,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Container.hbm.xml 29 Mar 2003 07:36:22 -0000 1.7 --- Container.hbm.xml 2 Apr 2003 13:10:38 -0000 1.8 *************** *** 57,60 **** --- 57,61 ---- </bag> <bag name="lazyBag" inverse="true" lazy="true" table="LCCBAG" cascade="save-update"> + <!--jcs-cache usage="read-write"--> <key column="container_id"/> <many-to-many column="contained_id" class="net.sf.hibernate.test.Contained"/> Index: FooBar.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/FooBar.hbm.xml,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** FooBar.hbm.xml 29 Mar 2003 07:36:22 -0000 1.11 --- FooBar.hbm.xml 2 Apr 2003 13:10:38 -0000 1.12 *************** *** 10,15 **** table="foos" proxy="net.sf.hibernate.test.FooProxy" ! discriminator-value="F" ! dynamic-update="true"> <jcs-cache usage="read-write"/> --- 10,14 ---- table="foos" proxy="net.sf.hibernate.test.FooProxy" ! discriminator-value="F"> <jcs-cache usage="read-write"/> Index: Glarch.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/Glarch.hbm.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Glarch.hbm.xml 29 Mar 2003 07:36:22 -0000 1.10 --- Glarch.hbm.xml 2 Apr 2003 13:10:38 -0000 1.11 *************** *** 3,7 **** <hibernate-mapping> ! <class name="net.sf.hibernate.test.Glarch" table="glarchez" proxy="net.sf.hibernate.test.GlarchProxy"> <!--<jcs-cache usage="read-write"/>--> <id type="string" column="tha_key" length="32"> --- 3,10 ---- <hibernate-mapping> ! <class name="net.sf.hibernate.test.Glarch" ! table="glarchez" ! proxy="net.sf.hibernate.test.GlarchProxy" ! dynamic-update="true"> <!--<jcs-cache usage="read-write"/>--> <id type="string" column="tha_key" length="32"> Index: MasterDetailTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/MasterDetailTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MasterDetailTest.java 8 Mar 2003 06:31:23 -0000 1.5 --- MasterDetailTest.java 2 Apr 2003 13:10:39 -0000 1.6 *************** *** 474,477 **** --- 474,496 ---- } + public void testNoUpdateManyToOne() throws Exception { + Session s = sessions.openSession(); + W w1 = new W(); + W w2 = new W(); + Z z = new Z(); + z.setW(w1); + s.save(z); + s.flush(); + z.setW(w2); + s.flush(); + s.connection().commit(); + s.close(); + + s = sessions.openSession(); + s.update(z); + s.flush(); + s.connection().commit(); + s.close(); + } public static Test suite() throws Exception { *************** *** 482,486 **** "Category.hbm.xml", "Nameable.hbm.xml", ! "SingleSeveral.hbm.xml" } ); --- 501,506 ---- "Category.hbm.xml", "Nameable.hbm.xml", ! "SingleSeveral.hbm.xml", ! "WZ.hbm.xml" } ); Index: Multi.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/Multi.hbm.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Multi.hbm.xml 29 Mar 2003 07:36:22 -0000 1.8 --- Multi.hbm.xml 2 Apr 2003 13:10:39 -0000 1.9 *************** *** 3,7 **** <hibernate-mapping> ! <class name="net.sf.hibernate.test.Simple" table="rootclass" dynamic-update="true"> <jcs-cache usage="read-write"/> <id type="long" column="id_" > --- 3,7 ---- <hibernate-mapping> ! <class name="net.sf.hibernate.test.Simple" table="rootclass"> <jcs-cache usage="read-write"/> <id type="long" column="id_" > *************** *** 43,47 **** </joined-subclass> ! <joined-subclass name="net.sf.hibernate.test.Multi" table="nonleafsubclass" dynamic-update="true"> <key column="sid"/> <property name="extraProp"/> --- 43,47 ---- </joined-subclass> ! <joined-subclass name="net.sf.hibernate.test.Multi" table="nonleafsubclass"> <key column="sid"/> <property name="extraProp"/> Index: ParentChildTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/ParentChildTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ParentChildTest.java 29 Mar 2003 07:36:22 -0000 1.8 --- ParentChildTest.java 2 Apr 2003 13:10:39 -0000 1.9 *************** *** 415,418 **** --- 415,425 ---- t = s.beginTransaction(); c = (Container) s.find("from c in class ContainerX").get(0); + c.getLazyBag().size(); + t.commit(); + s.close(); + + s = sessions.openSession(); + t = s.beginTransaction(); + c = (Container) s.find("from c in class ContainerX").get(0); Contained c3 = new Contained(); //c.getBag().add(c3); |