use of com.blazebit.persistence.view.testsuite.entity.LegacyOrderPositionDefault 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());
}
Aggregations