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

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


  public void testDeleteDependent() {
    Object parentId = null;
    Object child1Id = null;
    {
      Issue290Parent parent = new Issue290Parent("First Parent");
      Issue290Child child1 = new Issue290Child("Child 1");
      parent.getChildren().add(child1);
      Issue290Child child2 = new Issue290Child("Child 2");
      parent.getChildren().add(child2);
      pm.makePersistent(parent);
      parentId = pm.getObjectId(parent);
      child1Id = pm.getObjectId(child1);
      pm.close();
      pmf.getDataStoreCache().evictAll();
    }

    {
      PersistenceManager pm = pmf.getPersistenceManager();
      Issue290Parent parent = (Issue290Parent)pm.getObjectById(parentId);
      assertEquals("Number of children persisted was wrong", 2, parent.getChildren().size());

      Issue290Child child1 = (Issue290Child)pm.getObjectById(child1Id);

      // Remove from collection. Since not dependent, should leave in datastore
      parent.getChildren().remove(child1);
      assertFalse(JDOHelper.isDeleted(child1));
      pm.close();
View Full Code Here

TOP

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

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.