mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
33 lines
840 B
Java
33 lines
840 B
Java
package org.tests.cache;
|
|
|
|
import io.ebean.BaseTestCase;
|
|
import io.ebean.DB;
|
|
import org.junit.jupiter.api.Test;
|
|
import org.tests.model.basic.CKeyParent;
|
|
import org.tests.model.basic.CKeyParentId;
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|
|
|
public class TestCacheEmbeddedId extends BaseTestCase {
|
|
|
|
@Test
|
|
public void test() {
|
|
|
|
CKeyParentId id = new CKeyParentId(100, "testEmbedded");
|
|
|
|
CKeyParent p = new CKeyParent();
|
|
p.setId(id);
|
|
p.setName("testCache");
|
|
|
|
DB.save(p);
|
|
|
|
CKeyParent cKeyParent = DB.find(CKeyParent.class, id);
|
|
assertNotNull(cKeyParent);
|
|
|
|
// find for second time
|
|
// causes java.lang.ClassCastException: class java.lang.String cannot be cast to class org.tests.model.basic.CKeyParentId
|
|
cKeyParent = DB.find(CKeyParent.class, id);
|
|
assertNotNull(cKeyParent);
|
|
}
|
|
}
|