mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Add failing test case for softdeletes
Example: One X can have many Ys. Ys can be soft deleted. Y1 -> X1 -> Y1 Y1 is soft deleted When Y1 is loaded, lazy-loading X1 and then lazy-loading the list of Ys associated with X1, the list should contain Y1. This test asserts that is true.
This commit is contained in:
@@ -136,6 +136,26 @@ public class TestSoftDeleteBasic extends BaseTestCase {
|
||||
query.delete();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindSoftDeletedList() {
|
||||
EBasicSoftDelete bean = new EBasicSoftDelete();
|
||||
bean.setName("softDelFetch");
|
||||
DB.save(bean);
|
||||
|
||||
EBasicSDChild bean2 = new EBasicSDChild(bean, "softDelFetchus", 1L);
|
||||
DB.save(bean2);
|
||||
DB.delete(bean2);
|
||||
|
||||
EBasicSDChild child = DB
|
||||
.find(EBasicSDChild.class)
|
||||
.setIncludeSoftDeletes()
|
||||
.where()
|
||||
.idEq(bean.getId())
|
||||
.findOne();
|
||||
assertThat(child).isNotNull();
|
||||
assertThat(child.getOwner().getChildren().size()).isEqualTo(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteById_and_findCount() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user