1 | public void testAllParams() throws Exception {↵ | | 1 | public void testDeleteVersionedWithCollectionNoUpdate() {↵
|
| | | 2 | // test adapted from HHH-1564...
↵
|
2 | Session s = openSession();↵ | | 3 | Session s = openSession();
↵
|
3 | Transaction tx = s.beginTransaction();↵ | | 4 | s.beginTransaction();
↵
|
4 | Radio radio = new Radio();↵ | | 5 | ↵
|
5 | radio.setFrequency("32 MHz");↵ | | 6 | VersionedEntity c = new VersionedEntity( "c1", "child-1" );
↵
|
6 | s.persist(radio);↵ | | 7 | Versi↵
|
7 | assertEquals( new Integer(1), radio.getId() );↵ | | 8 | onedEntity p = new VersionedEntity( "root", "root");
↵
|
8 | radio = new Radio();↵ | | 9 | p.getChildren().add( c );
↵
|
9 | radio.setFrequency("32 MHz");↵ | | 10 | c.setParent( p );
↵
|
10 | s.persist(radio);↵ | | 11 | s.save( p );
↵
|
11 | assertEquals( new Integer(2), radio.getId() );↵ | | 12 | ↵
|
12 | tx.commit();↵ | | 13 | s.getTransaction().commit();
↵
|
13 | s.close();↵ | | 14 | s.close();↵
|
14 | ↵ | | |
|
|
| | | 15 | clearCounts();↵
|
| | | 16 |
↵
|
15 | s = openSession();↵ | | 17 | s = openSession();
↵
|
16 | tx = s.beginTransaction();↵ | | 18 | s.beginTransaction();↵
|
17 | s.createQuery( "delete from Radio" ).executeUpdate(↵ | | |
|
| | | 19 | VersionedEntity loadedParent = ( VersionedEntity ) s.get( VersionedEntity.class, "root" );↵
|
18 | );↵ | | 20 | s.delete( loadedParent );
↵
|
19 | tx.commit();↵ | | 21 | ↵
|
20 | s.close();↵ | | 22 | s.getTransaction().commit();↵
|
| | | 23 | s.close();↵
|
|
| | | 24 | assertInsertCount( 0 );↵
|
| | | 25 | assertUpdateCount( 0 );↵
|
| | | 26 | assertDeleteCount( 2 );
↵
|
21 | | | 27 |
|