use of com.blazebit.persistence.view.testsuite.update.remove.cascade.nested.model.UpdatableDocumentWithMapsView in project blaze-persistence by Blazebit.
the class EntityViewRemoveNestedSubviewMapsTest method testSimpleRemove.
@Test
public void testSimpleRemove() {
// Given
final UpdatableDocumentWithMapsView docView = getDoc1View();
clearQueries();
// When
remove(docView);
// Then
AssertStatementBuilder builder = assertUnorderedQuerySequence();
if (!isQueryStrategy()) {
// Hibernate loads the entities before deleting?
builder.select(Person.class).select(Person.class).select(Document.class).select(Version.class);
}
if (isQueryStrategy()) {
// Need to select the version id to be able to delete the localized set
builder.select(Version.class);
}
deleteDocumentOwned(builder);
deletePersonOwned(builder);
deletePersonOwned(builder);
// document.contacts.friend
builder.delete(Person.class).update(Document.class).delete(Person.class).update(Document.class).delete(Version.class).delete(Version.class, "localized").delete(Document.class).validate();
clearPersistenceContextAndReload();
assertNull(doc1);
assertNull(p1);
assertNull(p3);
}
Aggregations