*/
public class JPARecursiveParentTest extends JPATestCase {
public void testCreateParentAndChildDifferentTxn() {
HasRecursiveParent p = new HasRecursiveParent();
p.setName("yam");
beginTxn();
em.persist(p);
commitTxn();
String pid = p.getId();
beginTxn();
HasRecursiveParent p2 = em.find(HasRecursiveParent.class, pid);
HasRecursiveParent c = new HasRecursiveParent();
c.setName("yum");
c.setParent(p2);
p2.getChildren().add(c);
commitTxn();
String cid = c.getId();
beginTxn();
HasRecursiveParent c2 = em.find(HasRecursiveParent.class, cid);
HasRecursiveParent p3 = c2.getParent();
assertEquals(1, p3.getChildren().size());
assertEquals("yam", p3.getName());
assertEquals(p3.getChildren().iterator().next(), c2);
commitTxn();
}