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

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


  public void testOneToManyChildAtMultipleLevels_NoTxn() throws Exception {
    testOneToManyChildAtMultipleLevels(NEW_EM_START_END);
  }
  private void testOneToManyChildAtMultipleLevels(StartEnd startEnd)
      throws Exception {
    HasOneToManyChildAtMultipleLevelsJPA pojo = new HasOneToManyChildAtMultipleLevelsJPA();
    Book b1 = new Book();
    pojo.setBooks(Utils.newArrayList(b1));
    HasOneToManyChildAtMultipleLevelsJPA child = new HasOneToManyChildAtMultipleLevelsJPA();
    Book b2 = new Book();
    child.setBooks(Utils.newArrayList(b2));
    pojo.setChild(child);
    startEnd.start();
    em.persist(pojo);
    startEnd.end();
    startEnd.start();
    assertEquals(2, countForClass(Book.class));
    pojo = em.find(HasOneToManyChildAtMultipleLevelsJPA.class, pojo.getId());
    assertEquals(child.getId(), pojo.getChild().getId());
    assertEquals(1, pojo.getBooks().size());
    assertEquals(pojo.getBooks().get(0), b1);
    assertEquals(child.getBooks().get(0), b2);
    assertEquals(1, child.getBooks().size());
    startEnd.end();
  }
View Full Code Here

TOP

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

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.