use of com.haulmont.cuba.testmodel.many2many_fetchsameentity.Many2Many_FetchSame3 in project cuba by cuba-platform.
the class ManyToManyFetchSameEntityTest method setUp.
@BeforeEach
public void setUp() throws Exception {
Transaction tx = cont.persistence().createTransaction();
try {
EntityManager em = cont.persistence().getEntityManager();
Metadata metadata = cont.metadata();
same1_1 = metadata.create(Many2Many_FetchSame1.class);
same1_1.setName("same1_1");
em.persist(same1_1);
same1_2 = metadata.create(Many2Many_FetchSame1.class);
same1_2.setName("same1_2");
em.persist(same1_2);
same1_3 = metadata.create(Many2Many_FetchSame1.class);
same1_3.setName("same1_3");
em.persist(same1_3);
same2_1 = metadata.create(Many2Many_FetchSame2.class);
same2_1.setName("same2_1");
em.persist(same2_1);
same2_2 = metadata.create(Many2Many_FetchSame2.class);
same2_2.setName("same2_2");
em.persist(same2_2);
same2_3 = metadata.create(Many2Many_FetchSame2.class);
same2_3.setName("same2_3");
same2_3.setManyToOne1(same1_3);
em.persist(same2_3);
same2_4 = metadata.create(Many2Many_FetchSame2.class);
same2_4.setName("same2_4");
same2_4.setManyToOne1(same1_3);
em.persist(same2_4);
same3_1 = metadata.create(Many2Many_FetchSame3.class);
same3_1.setName("same3_1");
same3_1 = metadata.create(Many2Many_FetchSame3.class);
em.persist(same3_1);
same3_2 = metadata.create(Many2Many_FetchSame3.class);
same3_2.setName("same3_2");
same3_2 = metadata.create(Many2Many_FetchSame3.class);
em.persist(same3_2);
same1_1.setMany2(Collections.singletonList(same2_1));
same1_2.setMany2(Collections.singletonList(same2_2));
same2_3.setMany3(same3_1);
same2_4.setMany3(same3_2);
tx.commit();
} finally {
tx.end();
}
}
Aggregations