HHH-8374 test case

This commit is contained in:
Brett Meyer 2014-03-12 16:04:41 -04:00
parent 05c078e459
commit a71eb4786a
1 changed files with 24 additions and 4 deletions

View File

@ -23,16 +23,16 @@
*/
package org.hibernate.test.reattachment;
import static org.junit.Assert.assertEquals;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.junit.Test;
import org.hibernate.Session;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
/**
* Test of proxy reattachment semantics
@ -250,4 +250,24 @@ public class ProxyReattachmentTest extends BaseCoreFunctionalTestCase {
s.getTransaction().commit();
s.close();
}
@Test
@TestForIssue(jiraKey = "HHH-8374")
public void testRemoveAndReattachProxyEntity() {
Session s = openSession();
s.beginTransaction();
Parent p = new Parent("foo");
s.persist( p );
s.getTransaction().commit();
s.close();
s = openSession();
s.beginTransaction();
p = (Parent) s.load( Parent.class, p.getName() );
s.delete( p );
// re-attach
s.persist( p );
s.getTransaction().commit();
s.close();
}
}