Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test
In directory sc8-pr-cvs1:/tmp/cvs-serv19760/hibernate/test
Modified Files:
Master.java MasterDetail.hbm.xml MasterDetailTest.java
Log Message:
removed unnecessary collection delete when collection snapshot is empty
Index: Master.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/Master.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Master.java 20 Mar 2003 13:59:10 -0000 1.4
--- Master.java 16 Apr 2003 04:54:32 -0000 1.5
***************
*** 9,12 ****
--- 9,13 ----
public class Master implements Serializable, Named {
+ private Master otherMaster;
private Set details = new HashSet();
private Set moreDetails = new HashSet();
***************
*** 105,108 ****
--- 106,123 ----
}
+ /**
+ * @return
+ */
+ public Master getOtherMaster() {
+ return otherMaster;
+ }
+
+ /**
+ * @param master
+ */
+ public void setOtherMaster(Master master) {
+ otherMaster = master;
+ }
+
}
Index: MasterDetail.hbm.xml
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/MasterDetail.hbm.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** MasterDetail.hbm.xml 29 Mar 2003 07:36:22 -0000 1.7
--- MasterDetail.hbm.xml 16 Apr 2003 04:54:32 -0000 1.8
***************
*** 30,33 ****
--- 30,34 ----
</set>
<!-- <cache timeout="10000" type="readwrite"/> -->
+ <many-to-one name="otherMaster"/>
</class>
Index: MasterDetailTest.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/MasterDetailTest.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** MasterDetailTest.java 8 Apr 2003 09:49:34 -0000 1.7
--- MasterDetailTest.java 16 Apr 2003 04:54:32 -0000 1.8
***************
*** 29,32 ****
--- 29,50 ----
}
+ public void testSelfManyToOne() throws Exception {
+ Session s = sessions.openSession();
+ Transaction t = s.beginTransaction();
+ Master m = new Master();
+ m.setOtherMaster(m);
+ s.save(m);
+ t.commit();
+ s.close();
+ s = sessions.openSession();
+ t = s.beginTransaction();
+ Iterator i = s.iterate("from m in class Master");
+ m = (Master) i.next();
+ assertTrue( m.getOtherMaster()==m );
+ s.delete(m);
+ t.commit();
+ s.close();
+ }
+
public void testNonLazyBidirectional() throws Exception {
Session s = sessions.openSession();
|