NPE in cacheable bean with embeddedid on delete (#1570)

This commit is contained in:
Rien
2018-12-05 21:49:27 +13:00
committed by Rob Bygrave
parent ebf96c87bf
commit 0405ceb96c
2 changed files with 23 additions and 0 deletions
@@ -32,4 +32,23 @@ public class TestCKeyDelete extends BaseTestCase {
Assert.assertNull(notFound);
}
@Test
public void testDeleteWhere() {
CKeyParentId id = new CKeyParentId(100, "deleteMe");
CKeyParentId searchId = new CKeyParentId(100, "deleteMe");
CKeyParent p = new CKeyParent();
p.setId(id);
p.setName("testDelete");
Ebean.save(p);
Ebean.createQuery(CKeyParent.class).where().eq("id.oneKey", 100).delete();
CKeyParent found = Ebean.find(CKeyParent.class).where().idEq(searchId).findOne();
Assert.assertNull(found);
}
}
@@ -1,5 +1,8 @@
package org.tests.model.basic;
import io.ebean.annotation.Cache;
import javax.persistence.Cacheable;
import javax.persistence.CascadeType;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
@@ -10,6 +13,7 @@ import java.util.ArrayList;
import java.util.List;
@Entity
@Cache
public class CKeyParent {
@EmbeddedId