public void testListPersistUniNewBoth() throws EntityNotFoundException {
// Persist A-B as unowned
UnownedJPAOneToManyUniListSideA a = new UnownedJPAOneToManyUniListSideA();
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
UnownedJPAOneToManyUniListSideA a2 = em.find(UnownedJPAOneToManyUniListSideA.class, aId);
assertNotNull(a2);
assertEquals("Side A", a2.getName());
List<UnownedJPAOneToManyUniSideB> others = a2.getBs();
assertNotNull(others);
assertEquals(1, others.size());
UnownedJPAOneToManyUniSideB b2 = others.iterator().next();
assertNotNull(b2);
assertNotNull("Side B", b2.getName());
assertEquals(bId, b2.getId());
}