Examples of HasEmbeddableCollection


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

    assertEquals("yar2", pojo.getEmbeddable2().getEmbeddedString());
    commitTxn();
  }

  public void testEmbeddedCollectionOfEmbeddables() {
    HasEmbeddableCollection pojo = new HasEmbeddableCollection();
    EmbeddableJPA emb1 = new EmbeddableJPA();
    emb1.setEmbeddedString("The String1");
    pojo.getTheSet().add(emb1);
    EmbeddableJPA emb2 = new EmbeddableJPA();
    emb2.setEmbeddedString("The String2");
    pojo.getTheSet().add(emb2);
    beginTxn();
    em.persist(pojo);
    commitTxn();
    Long pk = pojo.getId();
    em.close();

    em = emf.createEntityManager();
    beginTxn();
    HasEmbeddableCollection thePojo = em.find(HasEmbeddableCollection.class, pk);
    assertNotNull(thePojo);
    Set<EmbeddableJPA> theEmbColl = thePojo.getTheSet();
    assertNotNull(thePojo);
    assertEquals("size of embedded collection is wrong", 2, theEmbColl.size());
    commitTxn();
    em.close();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.