Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test
In directory sc8-pr-cvs1:/tmp/cvs-serv21330/sf/hibernate/test
Modified Files:
MultiTableTest.java FooBarTest.java
Log Message:
detect collection modifications not made via wrapper
Index: MultiTableTest.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/MultiTableTest.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** MultiTableTest.java 3 Mar 2003 09:31:13 -0000 1.8
--- MultiTableTest.java 6 Mar 2003 11:11:39 -0000 1.9
***************
*** 7,10 ****
--- 7,11 ----
import java.util.HashSet;
import java.util.Iterator;
+ import java.util.List;
import java.util.Set;
***************
*** 36,45 ****
Session s = sessions.openSession();
!
if (dialect instanceof SybaseDialect) {
! s.save( new TrivialClass() );
}
else{
! s.save( new TrivialClass(), new Long(1) );
}
--- 37,46 ----
Session s = sessions.openSession();
! Long id = new Long(1);
if (dialect instanceof SybaseDialect) {
! id = (Long) s.save( new TrivialClass() );
}
else{
! s.save( new TrivialClass(), id );
}
***************
*** 48,52 ****
s.close();
s = sessions.openSession();
! TrivialClass tc = (TrivialClass) s.load( TrivialClass.class, new Long(1) );
s.find("from s in class TrivialClass where s.id = 2");
s.find("select s.count from s in class Simple");
--- 49,53 ----
s.close();
s = sessions.openSession();
! TrivialClass tc = (TrivialClass) s.load(TrivialClass.class, id);
s.find("from s in class TrivialClass where s.id = 2");
s.find("select s.count from s in class Simple");
***************
*** 434,437 ****
--- 435,458 ----
}
+ public void testCollectionPointer() throws Exception {
+ Session sess = sessions.openSession();
+ LessSimple ls = new LessSimple();
+ List list = new ArrayList();
+ ls.setBag(list);
+ Simple s = new Simple();
+ Serializable id = sess.save(ls);
+ sess.save(s);
+ sess.flush();
+ list.add(s);
+ sess.flush();
+ sess.connection().commit();
+
+ sess = sessions.openSession();
+ ls = (LessSimple) sess.load(LessSimple.class, id);
+ assertTrue( ls.getBag().size()==1 );
+ sess.delete("from o in class java.lang.Object");
+ sess.flush();
+ sess.connection().commit();
+ }
public static Test suite() throws Exception {
Index: FooBarTest.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/FooBarTest.java,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** FooBarTest.java 4 Mar 2003 10:53:47 -0000 1.37
--- FooBarTest.java 6 Mar 2003 11:11:45 -0000 1.38
***************
*** 136,140 ****
}
! public void testFindLike() throws Exception {
Session s = sessions.openSession();
Foo f = new Foo();
--- 136,140 ----
}
! /*public void testFindLike() throws Exception {
Session s = sessions.openSession();
Foo f = new Foo();
***************
*** 150,154 ****
s.flush();
s.close();
! }
public void testAfterDelete() throws Exception {
--- 150,154 ----
s.flush();
s.close();
! }*/
public void testAfterDelete() throws Exception {
|