*/
public class JPAUnownedOneToManyTest extends JPATestCase {
public void testSetPersistUniNewBoth() throws EntityNotFoundException {
// Persist A-B as unowned
UnownedJPAOneToManyUniSetSideA a = new UnownedJPAOneToManyUniSetSideA();
a.setName("Side A");
UnownedJPAOneToManyUniSideB b = new UnownedJPAOneToManyUniSideB();
b.setName("Side B");
a.addB(b);
em.persist(a);
Long aId = a.getId();
Long bId = b.getId();
em.clear(); // Make sure we go to the datastore
// Retrieve by id and check
UnownedJPAOneToManyUniSetSideA a2 = em.find(UnownedJPAOneToManyUniSetSideA.class, aId);
assertNotNull(a2);
assertEquals("Side A", a2.getName());
Set<UnownedJPAOneToManyUniSideB> others = a2.getBs();
assertNotNull(others);
assertEquals(1, others.size());
UnownedJPAOneToManyUniSideB b2 = others.iterator().next();
assertNotNull(b2);
assertNotNull("Side B", b2.getName());