mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Discriminator query cache error
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
package org.tests.inheritance;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.EbeanServer;
|
||||
import org.junit.Test;
|
||||
import org.tests.inheritance.model.GroupConfiguration;
|
||||
import org.tests.inheritance.model.ProductConfiguration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TestInheritanceDiscriminatorQueryCache extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void testDiscriminatorQueryCache() {
|
||||
EbeanServer server = Ebean.getDefaultServer();
|
||||
|
||||
ProductConfiguration pc1 = new ProductConfiguration();
|
||||
pc1.setName("PC1");
|
||||
server.save(pc1);
|
||||
|
||||
ProductConfiguration pc2 = new ProductConfiguration();
|
||||
pc1.setName("PC2");
|
||||
server.save(pc2);
|
||||
|
||||
GroupConfiguration gc1 = new GroupConfiguration();
|
||||
gc1.setName("GC1");
|
||||
server.save(gc1);
|
||||
|
||||
GroupConfiguration gc2 = new GroupConfiguration();
|
||||
gc1.setName("GC2");
|
||||
server.save(gc2);
|
||||
|
||||
List<ProductConfiguration> list1 = server.createQuery(ProductConfiguration.class).setUseQueryCache(true).findList();
|
||||
List<GroupConfiguration> list2 = server.createQuery(GroupConfiguration.class).setUseQueryCache(true).findList();
|
||||
|
||||
for(ProductConfiguration pc : list1) {
|
||||
System.out.print(pc.getProductName());
|
||||
}
|
||||
for(GroupConfiguration gc : list2) {
|
||||
System.out.print(gc.getGroupName());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,18 +1,13 @@
|
||||
package org.tests.inheritance.model;
|
||||
|
||||
import io.ebean.annotation.Cache;
|
||||
import io.ebean.annotation.ChangeLog;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.DiscriminatorColumn;
|
||||
import javax.persistence.DiscriminatorType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Inheritance;
|
||||
import javax.persistence.InheritanceType;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.*;
|
||||
|
||||
@ChangeLog
|
||||
@Entity
|
||||
@Cache(enableQueryCache = true)
|
||||
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||
@DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.STRING)
|
||||
public class Configuration extends AbstractBaseClass {
|
||||
|
||||
Reference in New Issue
Block a user