Package com.google.appengine.datanucleus.test.jpa

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


  }

  public void testSerializeWithOneToMany_AddGrandchildToUnidirectionalDetached() throws Exception {
    beginTxn();
    HasGrandchildJPA hasGrandchild = new HasGrandchildJPA();
    HasOneToManySetJPA pojo = new HasOneToManySetJPA();
    hasGrandchild.getYar().add(pojo);
    pojo.setVal("yar");
    Book b = new Book();
    b.setAuthor("harry");
    pojo.getBooks().add(b);
    em.persist(hasGrandchild);
    commitTxn();
    em.close();
    em = emf.createEntityManager();

    hasGrandchild = toBytesAndBack(hasGrandchild);
    pojo = hasGrandchild.getYar().iterator().next();
    assertEquals("yar", pojo.getVal());
    assertEquals(1, pojo.getBooks().size());
    Book b2 = new Book();
    b2.setAuthor("yar3");
    pojo.getBooks().add(b2);
    // Don't set the parent - this ref won't get updated when we call
    // merge and we'll get an exception.
//    bidir2.setParent(pojo);
    beginTxn();
    hasGrandchild = em.merge(hasGrandchild);
    commitTxn();
    Entity e = ds.get(KeyFactory.stringToKey(b2.getId()));
    assertEquals(KeyFactory.stringToKey(pojo.getId()), e.getKey().getParent());
  }
View Full Code Here


* @author Max Ross <maxr@google.com>
*/
public class JPAOneToManySetTest extends JPAOneToManyTestCase {

  public void testInsert_NewParentAndChild() throws Exception {
    testInsert_NewParentAndChild(new BidirectionalChildSetJPA(), new HasOneToManySetJPA(),
                                 TXN_START_END);
  }
View Full Code Here

    testInsert_NewParentAndChild(new BidirectionalChildSetJPA(), new HasOneToManySetJPA(),
                                 TXN_START_END);
  }

  public void testInsert_NewParentAndChild_NoTxn() throws Exception {
    testInsert_NewParentAndChild(new BidirectionalChildSetJPA(), new HasOneToManySetJPA(),
                                 NEW_EM_START_END);
  }
View Full Code Here

    testInsert_NewParentAndChild(new BidirectionalChildSetJPA(), new HasOneToManySetJPA(),
                                 NEW_EM_START_END);
  }

  public void testInsert_ExistingParentNewChild() throws Exception {
    testInsert_ExistingParentNewChild(new BidirectionalChildSetJPA(), new HasOneToManySetJPA(),
                                      TXN_START_END);
  }
View Full Code Here

    testInsert_ExistingParentNewChild(new BidirectionalChildSetJPA(), new HasOneToManySetJPA(),
                                      TXN_START_END);
  }

  public void testInsert_ExistingParentNewChild_NoTxn() throws Exception {
    testInsert_ExistingParentNewChild(new BidirectionalChildSetJPA(), new HasOneToManySetJPA(),
                                      NEW_EM_START_END);
  }
View Full Code Here

    testInsert_ExistingParentNewChild(new BidirectionalChildSetJPA(), new HasOneToManySetJPA(),
                                      NEW_EM_START_END);
  }

  public void testUpdate_UpdateChildWithMerge() throws Exception {
    testUpdate_UpdateChildWithMerge(new BidirectionalChildSetJPA(), new HasOneToManySetJPA(),
                                    TXN_START_END);
  }
View Full Code Here

  public void testUpdate_UpdateChildWithMerge() throws Exception {
    testUpdate_UpdateChildWithMerge(new BidirectionalChildSetJPA(), new HasOneToManySetJPA(),
                                    TXN_START_END);
  }
  public void testUpdate_UpdateChildWithMerge_NoTxn() throws Exception {
    testUpdate_UpdateChildWithMerge(new BidirectionalChildSetJPA(), new HasOneToManySetJPA(),
                                    NEW_EM_START_END);
  }
View Full Code Here

    testUpdate_UpdateChildWithMerge(new BidirectionalChildSetJPA(), new HasOneToManySetJPA(),
                                    NEW_EM_START_END);
  }

  public void testUpdate_UpdateChild() throws Exception {
    testUpdate_UpdateChild(new BidirectionalChildSetJPA(), new HasOneToManySetJPA(),
                           TXN_START_END);
  }
View Full Code Here

  public void testUpdate_UpdateChild() throws Exception {
    testUpdate_UpdateChild(new BidirectionalChildSetJPA(), new HasOneToManySetJPA(),
                           TXN_START_END);
  }
  public void testUpdate_UpdateChild_NoTxn() throws Exception {
    testUpdate_UpdateChild(new BidirectionalChildSetJPA(), new HasOneToManySetJPA(),
                           NEW_EM_START_END);
  }
View Full Code Here

    testUpdate_UpdateChild(new BidirectionalChildSetJPA(), new HasOneToManySetJPA(),
                           NEW_EM_START_END);
  }

  public void testUpdate_NullOutChildren() throws Exception {
    testUpdate_NullOutChildren(new BidirectionalChildSetJPA(), new HasOneToManySetJPA(),
                               TXN_START_END);
  }
View Full Code Here

TOP

Related Classes of com.google.appengine.datanucleus.test.jpa.HasOneToManySetJPA

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.