EntityManager em = currentEntityManager();
startTx(em);
InterfaceHolder holder = new InterfaceHolder(1);
em.persist(holder);
holder.setIntf(new InterfaceTestImpl1("intf-1-field"));
assertEquals("intf-1-field", holder.getIntf().getStringField());
endTx(em);
endEm(em);
em = currentEntityManager();
startTx(em);
InterfaceHolder hold =
(InterfaceHolder) em.find(InterfaceHolder.class, 1);
assertNotNull(hold.getIntf());
assertEquals("intf-1-field", hold.getIntf().getStringField());
endTx(em);
endEm(em);
em = currentEntityManager();
startTx(em);
hold = (InterfaceHolder) em.find(InterfaceHolder.class, 1);
hold.setIntf(null);
assertNull(hold.getIntf());
endTx(em);
endEm(em);
em = currentEntityManager();
startTx(em);
hold = (InterfaceHolder) em.find(InterfaceHolder.class, 1);
assertNull(hold.getIntf());
endTx(em);
endEm(em);
em = currentEntityManager();
startTx(em);
hold = (InterfaceHolder) em.find(InterfaceHolder.class, 1);
hold.setIntf(new InterfaceTestImpl2("intf-2-field"));
assertEquals("intf-2-field", hold.getIntf().getStringField());
endTx(em);
endEm(em);
em = currentEntityManager();
startTx(em);
hold = (InterfaceHolder) em.find(InterfaceHolder.class, 1);
assertNotNull(hold.getIntf());
assertEquals("intf-2-field", hold.getIntf().getStringField());
endTx(em);
endEm(em);
em = currentEntityManager();
startTx(em);
hold = (InterfaceHolder) em.find(InterfaceHolder.class, 1);
hold.getIntfs().add(new InterfaceTestImpl1("intf-1-set"));
endTx(em);
endEm(em);
// em = currentEntityManager();
// startTx(em);