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

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


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

public class Issue62Test extends JDOTestCase {

  public void testMultipleOneToOne() {
    Issue62Parent parent;
    Issue62Child child;
    {
      child = new Issue62Child();
      parent = new Issue62Parent(child);
      pm.makePersistent(parent);
      pm.close();
    }

    // Create a second parent/child and next update the first child with the second parent
    Issue62Parent parent2;
    {
      pm = pmf.getPersistenceManager();
      parent2 = new Issue62Parent(new Issue62Child());
      pm.makePersistent(parent2);
      pm.close();

      try {
        pm = pmf.getPersistenceManager();
        pm.currentTransaction().begin();
        Issue62Child childToChangeParent = pm.getObjectById(Issue62Child.class, child.getId());
        assertNotNull(childToChangeParent);
        childToChangeParent.setParent(parent2);
        parent2.setChild(childToChangeParent);
        pm.currentTransaction().commit();
        fail("Didn't throw exception on attempt to change parent");
      } catch (JDOException jdoe) {
        // Expected
      }
View Full Code Here

TOP

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

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.