Package com.google.appengine.datanucleus.test.jdo

Examples of com.google.appengine.datanucleus.test.jdo.Issue73Parent


import com.google.appengine.datanucleus.test.jdo.Issue73Parent;

public class Issue73Test extends JDOTestCase {

  public void testMultipleOneToOne() {
    Issue73Parent p = new Issue73Parent();
    p.setName("First Parent");
    Issue73Child c1 = new Issue73Child();
    c1.setName("Child 1");
    p.setChild1(c1);
    Issue73Child c2 = new Issue73Child();
    c2.setName("Child 2");
    p.setChild2(c2);

    // Persist parent with 2 children
    Object id = null;
    beginTxn();
    pm.makePersistent(p);
    commitTxn();
    id = pm.getObjectId(p);
    pm.close();

    // Retrieve and check the results
    pm = pmf.getPersistenceManager();
    beginTxn();
    Issue73Parent p1 = (Issue73Parent)pm.getObjectById(id);
    Issue73Child c1a = p1.getChild1();
    Issue73Child c2a = p1.getChild2();
    assertNotNull(c1a);
    assertNotNull(c2a);
    assertEquals("Child 1", c1a.getName());
    assertEquals("Child 2", c2a.getName());
View Full Code Here

TOP

Related Classes of com.google.appengine.datanucleus.test.jdo.Issue73Parent

Copyright © 2018 www.massapicom. 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.