use of com.blazebit.persistence.view.testsuite.update.remove.cascade.nested.model.UpdatableDocumentView in project blaze-persistence by Blazebit.
the class EntityViewRemoveNestedSubviewTest method testSimpleRemove.
@Test
public void testSimpleRemove() {
// Given
final UpdatableDocumentView 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, true);
deletePersonOwned(builder, true);
// document.responsiblePerson.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