Search in sources :

Example 6 with UpdatableLegacyOrderView

use of com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.complex.model.UpdatableLegacyOrderView in project blaze-persistence by Blazebit.

the class EntityViewUpdateSubviewInverseEmbeddedComplexTest method testRemoveById.

// Test for https://github.com/Blazebit/blaze-persistence/issues/1299
@Test
public void testRemoveById() {
    // Given
    UpdatableLegacyOrderView newOrder = evm.create(UpdatableLegacyOrderView.class);
    UpdatableLegacyOrderPositionView position = evm.create(UpdatableLegacyOrderPositionView.class);
    position.getId().setPositionId(0);
    position.setArticleNumber("123");
    newOrder.getPositions().add(position);
    update(newOrder);
    // When
    em.clear();
    evm.remove(em, UpdatableLegacyOrderView.class, newOrder.getId());
    em.flush();
    em.clear();
    // Then
    LegacyOrder legacyOrder = em.find(LegacyOrder.class, newOrder.getId());
    Assert.assertNull(legacyOrder);
}
Also used : UpdatableLegacyOrderPositionView(com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.complex.model.UpdatableLegacyOrderPositionView) LegacyOrder(com.blazebit.persistence.view.testsuite.entity.LegacyOrder) UpdatableLegacyOrderView(com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.complex.model.UpdatableLegacyOrderView) AbstractEntityViewUpdateTest(com.blazebit.persistence.view.testsuite.update.AbstractEntityViewUpdateTest) Test(org.junit.Test)

Aggregations

LegacyOrder (com.blazebit.persistence.view.testsuite.entity.LegacyOrder)6 AbstractEntityViewUpdateTest (com.blazebit.persistence.view.testsuite.update.AbstractEntityViewUpdateTest)6 UpdatableLegacyOrderView (com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.complex.model.UpdatableLegacyOrderView)6 Test (org.junit.Test)6 LegacyOrderPositionId (com.blazebit.persistence.view.testsuite.entity.LegacyOrderPositionId)4 CreatableLegacyOrderPositionView (com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.complex.model.CreatableLegacyOrderPositionView)4 LegacyOrderPosition (com.blazebit.persistence.view.testsuite.entity.LegacyOrderPosition)2 UpdatableLegacyOrderPositionView (com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.complex.model.UpdatableLegacyOrderPositionView)2 PluralChangeModel (com.blazebit.persistence.view.change.PluralChangeModel)1 CreatableLegacyOrderPositionElementView (com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.complex.model.CreatableLegacyOrderPositionElementView)1 UpdatableLegacyOrderPositionDefaultView (com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.complex.model.UpdatableLegacyOrderPositionDefaultView)1