1 | public void testSaveOrUpdateCopyAny() throws Exception {↵ | | 1 | public void testEmptyCollection() throws Exception {↵
|
2 | Session s = openSession();↵ | | 2 | Session s = openSession();↵
|
3 | Bar bar = new Bar();↵ | | 3 | Serializable id = s.save( new Baz() );↵
|
4 | One one = new One();↵ | | 4 | ↵
|
5 | bar.setObject(one);↵ | | |
|
6 | s.save(bar);↵ | | |
|
7 | GlarchProxy g = bar.getComponent().getGlarch();↵ | | |
|
8 | bar.getComponent().setGlarch(null);↵ | | |
|
9 | s.delete(g);↵ | | |
|
10 | s.flush↵ | | 5 | s.flush();↵
|
| | | 6 | s.connection().commit();↵
|
| | | 7 | s.close();↵
|
| | | 8 | s = openSession();↵
|
| | | 9 | Baz baz = (Baz) s.load(Baz.class, id);↵
|
11 | ();↵ | | 10 | Set foos = baz.getFooSet();↵
|
12 | assertTrue( s.contains(one) );↵ | | 11 | assertTrue( ↵
|
13 | s.connection().commit();↵ | | |
|
14 | s.close();↵ | | |
|
|
15 | s = openSession();↵ | | |
|
16 | Bar bar2 = (Bar) s.saveOrUpdateCopy(bar↵ | | 12 | foos.size()==0 );↵
|
| | | 13 | Foo foo = new Foo();↵
|
| | | 14 | foos.add(foo);↵
|
17 | );↵ | | 15 | s.save(foo);↵
|
18 | s.flush();↵ | | 16 | s.flush();↵
|
19 | s.delete(bar2↵ | | 17 | s.delete(foo);↵
|
20 | );↵ | | 18 | s.delete(baz);↵
|
21 | s.flush();↵ | | 19 | s.flush();↵
|
22 | s.connection().commit();↵ | | 20 | s.connection().commit();↵
|
23 | s.close();↵ | | 21 | s.close();↵
|
24 | | | 22 |
|