Examples of UnownedJPAOneToManyUniSetSideA


Examples of com.google.appengine.datanucleus.test.jpa.UnownedJPAOneToManyUniSetSideA

*/
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());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.