use of com.blazebit.persistence.view.testsuite.entity.EmbeddableTestEntityId2 in project blaze-persistence by Blazebit.
the class EmbeddableTestEntityViewTest method setUp.
@Before
public void setUp() {
cleanDatabase();
transactional(new TxVoidWork() {
@Override
public void work(EntityManager em) {
IntIdEntity intIdEntity1 = new IntIdEntity("1");
entity1 = new EmbeddableTestEntity2();
entity1.setId(new EmbeddableTestEntityId2(intIdEntity1, "1"));
entity1.getEmbeddableSet().add(new EmbeddableTestEntitySimpleEmbeddable2("1"));
entity1.getEmbeddableMap().put("key1", new EmbeddableTestEntitySimpleEmbeddable2("1"));
entity1.getEmbeddable().setName("1");
entity1.getEmbeddable().setManyToOne(null);
entity1.getEmbeddable().getElementCollection().put("1", intIdEntity1);
IntIdEntity intIdEntity2 = new IntIdEntity("2");
entity2 = new EmbeddableTestEntity2();
entity2.setId(new EmbeddableTestEntityId2(intIdEntity2, "2"));
entity2.getEmbeddableSet().add(new EmbeddableTestEntitySimpleEmbeddable2("2"));
entity2.getEmbeddableMap().put("key2", new EmbeddableTestEntitySimpleEmbeddable2("2"));
entity2.getEmbeddable().setName("2");
entity2.getEmbeddable().setManyToOne(entity1);
entity2.getEmbeddable().getElementCollection().put("2", intIdEntity2);
em.persist(intIdEntity1);
em.persist(intIdEntity2);
em.persist(entity1);
em.persist(entity2);
}
});
entity1 = cbf.create(em, EmbeddableTestEntity2.class).fetch("id.intIdEntity", "embeddableSet", "embeddableMap", "embeddable.manyToOne", "embeddable.oneToMany", "embeddable.elementCollection").where("id").eq(entity1.getId()).getSingleResult();
entity2 = cbf.create(em, EmbeddableTestEntity2.class).fetch("id.intIdEntity", "embeddableSet", "embeddableMap", "embeddable.manyToOne", "embeddable.oneToMany", "embeddable.elementCollection").where("id").eq(entity2.getId()).getSingleResult();
}
Aggregations