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();
}