use of com.blazebit.persistence.testsuite.tx.TxVoidWork in project blaze-persistence by Blazebit.
the class LimitTest method setUpOnce.
@Override
public void setUpOnce() {
cleanDatabase();
transactional(new TxVoidWork() {
@Override
public void work(EntityManager em) {
Person o1 = new Person("pers1");
Document doc1 = new Document("doc1", o1);
doc1.setAge(10);
Document doc2 = new Document("doc2", o1);
doc2.setAge(5);
Document doc3 = new Document("doc3", o1);
doc3.setAge(10);
em.persist(o1);
em.persist(doc1);
em.persist(doc2);
em.persist(doc3);
}
});
}
use of com.blazebit.persistence.testsuite.tx.TxVoidWork in project blaze-persistence by Blazebit.
the class EntityViewUpdateSubviewInverseEmbeddedSimpleTest method testLoadMultipleUpdatableWithUpdatableFlatViewIds.
@Test
public void testLoadMultipleUpdatableWithUpdatableFlatViewIds() {
transactional(new TxVoidWork() {
@Override
public void work(EntityManager em) {
LegacyOrder o = new LegacyOrder();
em.persist(o);
LegacyOrderPosition p = new LegacyOrderPosition(new LegacyOrderPositionId(o.getId(), 0));
p.setArticleNumber("123");
p.setOrder(o);
em.persist(p);
o.getPositions().add(p);
LegacyOrderPositionDefault d1 = new LegacyOrderPositionDefault(new LegacyOrderPositionDefaultId(p.getId(), 1));
d1.setValue("1");
em.persist(d1);
LegacyOrderPositionDefault d2 = new LegacyOrderPositionDefault(new LegacyOrderPositionDefaultId(p.getId(), 2));
d2.setValue("1");
em.persist(d2);
p.getDefaults().add(d1);
p.getDefaults().add(d2);
}
});
em.clear();
List<UpdatableLegacyOrderPositionDefaultView> resultList = evm.applySetting(EntityViewSetting.create(UpdatableLegacyOrderPositionDefaultView.class), cbf.create(em, LegacyOrderPositionDefault.class)).getResultList();
// Making the id view updatable at some point caused just a part of the id to be considered when de-duplicating updatable views
assertEquals(2, resultList.size());
assertNotEquals(resultList.get(0).getId(), resultList.get(1).getId());
}
use of com.blazebit.persistence.testsuite.tx.TxVoidWork in project blaze-persistence by Blazebit.
the class ListaggTest method setUpOnce.
@Override
public void setUpOnce() {
cleanDatabase();
transactional(new TxVoidWork() {
@Override
public void work(EntityManager em) {
Person p = new Person("Pers1");
p.setAge(20L);
em.persist(p);
Version v1 = new Version();
Document doc1 = new Document("Doc1", p, v1);
em.persist(doc1);
em.persist(v1);
Version v2 = new Version();
v2.setUrl("b");
Document doc2 = new Document("Doc1", p, v2);
em.persist(doc2);
em.persist(v2);
Version v3 = new Version();
v3.setUrl("a");
Document doc3 = new Document("Doc2", p, v3);
em.persist(doc3);
em.persist(v3);
}
});
}
use of com.blazebit.persistence.testsuite.tx.TxVoidWork in project blaze-persistence by Blazebit.
the class CollectionRoleDeleteTest method setUp.
@Before
public void setUp() {
cleanDatabase();
transactional(new TxVoidWork() {
@Override
public void work(EntityManager em) {
Root r = new Root(1, "r");
IndexedNode i1 = new IndexedNode(2, r);
KeyedNode k1 = new KeyedNode(3, r);
r.getIndexedNodes().add(i1);
r.getIndexedNodesMany().add(i1);
r.getIndexedNodesManyDuplicate().add(i1);
r.getIndexedNodesElementCollection().add(new IndexedEmbeddable("a", "b"));
r.getKeyedNodes().put("a", k1);
r.getKeyedNodesMany().put("a", k1);
r.getKeyedNodesManyDuplicate().put("a", k1);
r.getKeyedNodesElementCollection().put("a", new KeyedEmbeddable("a", "b"));
em.persist(i1);
em.persist(k1);
em.persist(r);
}
});
}
use of com.blazebit.persistence.testsuite.tx.TxVoidWork in project blaze-persistence by Blazebit.
the class CollectionRoleInsertTest method setUp.
@Before
public void setUp() {
cleanDatabase();
transactional(new TxVoidWork() {
@Override
public void work(EntityManager em) {
Root r = new Root(1);
IndexedNode i1 = new IndexedNode(2);
KeyedNode k1 = new KeyedNode(3);
r.getIndexedNodes().add(i1);
r.getIndexedNodesMany().add(i1);
r.getIndexedNodesManyDuplicate().add(i1);
r.getIndexedNodesElementCollection().add(new IndexedEmbeddable("a", "b"));
r.getKeyedNodes().put("a", k1);
r.getKeyedNodesMany().put("a", k1);
r.getKeyedNodesManyDuplicate().put("a", k1);
r.getKeyedNodesElementCollection().put("a", new KeyedEmbeddable("a", "b"));
em.persist(i1);
em.persist(k1);
em.persist(r);
IndexedNode i2 = new IndexedNode(I2_ID);
em.persist(i2);
KeyedNode k2 = new KeyedNode(K2_ID);
em.persist(k2);
}
});
}
Aggregations