mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Refactor tests, move some cache tests to ebean-core
This commit is contained in:
+123
@@ -0,0 +1,123 @@
|
||||
package io.ebeaninternal.server.cache;
|
||||
|
||||
import io.ebean.DB;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebean.bean.PersistenceContext;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import io.ebeaninternal.server.deploy.BeanPropertyAssocOne;
|
||||
import io.ebeaninternal.server.transaction.DefaultPersistenceContext;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.basic.Address;
|
||||
import org.tests.model.basic.Country;
|
||||
import org.tests.model.basic.Customer;
|
||||
import org.tests.model.basic.Customer.Status;
|
||||
import org.tests.model.embedded.EAddress;
|
||||
import org.tests.model.embedded.EPerson;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
public class CacheBeanDataTest {
|
||||
|
||||
@Test
|
||||
public void extract_load_on_customer() {
|
||||
|
||||
SpiEbeanServer server = (SpiEbeanServer)DB.getDefault();
|
||||
BeanDescriptor<Customer> desc = server.descriptor(Customer.class);
|
||||
|
||||
Customer c = new Customer();
|
||||
c.setId(98989);
|
||||
c.setName("Rob");
|
||||
c.setCretime(new Timestamp(System.currentTimeMillis()));
|
||||
c.setUpdtime(new Timestamp(System.currentTimeMillis()));
|
||||
c.setStatus(Status.ACTIVE);
|
||||
c.setSmallnote("somenote");
|
||||
|
||||
Address billingAddress = new Address();
|
||||
billingAddress.setId(12);
|
||||
billingAddress.setCity("Auckland");
|
||||
billingAddress.setCountry(server.reference(Country.class, "NZ"));
|
||||
billingAddress.setLine1("92 Someplace Else");
|
||||
c.setBillingAddress(billingAddress);
|
||||
|
||||
((EntityBean) c)._ebean_getIntercept().setLoaded();
|
||||
|
||||
CachedBeanData cacheData = CachedBeanDataFromBean.extract(desc, (EntityBean) c);
|
||||
|
||||
|
||||
assertNotNull(cacheData);
|
||||
|
||||
Customer newCustomer = new Customer();
|
||||
newCustomer.setId(c.getId());
|
||||
CachedBeanDataToBean.load(desc, (EntityBean) newCustomer, cacheData, new DefaultPersistenceContext());
|
||||
|
||||
assertEquals(c.getId(), newCustomer.getId());
|
||||
assertEquals(c.getName(), newCustomer.getName());
|
||||
assertEquals(c.getStatus(), newCustomer.getStatus());
|
||||
assertEquals(c.getSmallnote(), newCustomer.getSmallnote());
|
||||
assertEquals(c.getCretime(), newCustomer.getCretime());
|
||||
assertEquals(c.getUpdtime(), newCustomer.getUpdtime());
|
||||
assertEquals(c.getBillingAddress().getId(), newCustomer.getBillingAddress().getId());
|
||||
|
||||
assertNotNull(newCustomer.getId());
|
||||
assertNotNull(newCustomer.getName());
|
||||
assertNotNull(newCustomer.getStatus());
|
||||
assertNotNull(newCustomer.getSmallnote());
|
||||
assertNotNull(newCustomer.getCretime());
|
||||
assertNotNull(newCustomer.getUpdtime());
|
||||
assertNotNull(newCustomer.getBillingAddress());
|
||||
assertNotNull(newCustomer.getBillingAddress().getId());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void extract_load_withEmbeddedBean() {
|
||||
|
||||
SpiEbeanServer server = (SpiEbeanServer)DB.getDefault();
|
||||
BeanDescriptor<EPerson> desc = server.descriptor(EPerson.class);
|
||||
BeanPropertyAssocOne<?> addressBeanProperty = (BeanPropertyAssocOne<?>) desc.beanProperty("address");
|
||||
|
||||
EAddress address = new EAddress();
|
||||
address.setStreet("92 Someplace Else");
|
||||
address.setSuburb("Sandringham");
|
||||
address.setCity("Auckland");
|
||||
|
||||
EPerson person = new EPerson();
|
||||
person.setId(98989L);
|
||||
person.setName("Rob");
|
||||
person.setAddress(address);
|
||||
|
||||
CachedBeanData addressCacheData = (CachedBeanData) addressBeanProperty.getCacheDataValue((EntityBean) person);
|
||||
|
||||
PersistenceContext context = new DefaultPersistenceContext();
|
||||
|
||||
EPerson newPersonCheck = new EPerson();
|
||||
newPersonCheck.setId(98989L);
|
||||
addressBeanProperty.setCacheDataValue((EntityBean) newPersonCheck, addressCacheData, context);
|
||||
|
||||
EAddress newAddress = newPersonCheck.getAddress();
|
||||
assertEquals(address.getStreet(), newAddress.getStreet());
|
||||
assertEquals(address.getCity(), newAddress.getCity());
|
||||
assertEquals(address.getSuburb(), newAddress.getSuburb());
|
||||
|
||||
|
||||
CachedBeanData cacheData = desc.cacheEmbeddedBeanExtract((EntityBean) person);
|
||||
|
||||
assertNotNull(cacheData);
|
||||
|
||||
EPerson newPerson = (EPerson) desc.cacheEmbeddedBeanLoad(cacheData, context);
|
||||
|
||||
assertNotNull(newPerson.getId());
|
||||
assertNotNull(newPerson.getName());
|
||||
assertNotNull(newPerson.getAddress());
|
||||
|
||||
assertEquals(person.getId(), newPerson.getId());
|
||||
assertEquals(person.getName(), newPerson.getName());
|
||||
assertEquals(person.getAddress().getStreet(), newPerson.getAddress().getStreet());
|
||||
assertEquals(person.getAddress().getCity(), newPerson.getAddress().getCity());
|
||||
}
|
||||
}
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
package io.ebeaninternal.server.cache;
|
||||
|
||||
import io.ebean.DB;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import io.ebeaninternal.server.transaction.DefaultPersistenceContext;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.basic.Address;
|
||||
import org.tests.model.basic.Car;
|
||||
import org.tests.model.basic.Contact;
|
||||
import org.tests.model.basic.Customer;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class CachedBeanDataFromBeanTest {
|
||||
|
||||
private final SpiEbeanServer server = (SpiEbeanServer)DB.getDefault();
|
||||
|
||||
@Test
|
||||
public void extract() {
|
||||
|
||||
BeanDescriptor<Customer> desc = server.descriptor(Customer.class);
|
||||
|
||||
Date largeDate = new Date(9223372036825200000L);
|
||||
|
||||
Customer customer = new Customer();
|
||||
customer.setId(42);
|
||||
customer.setName("Rob");
|
||||
customer.setAnniversary(largeDate);
|
||||
|
||||
Address billingAddress = new Address();
|
||||
billingAddress.setId(12);
|
||||
billingAddress.setCity("SomePlace");
|
||||
|
||||
customer.setBillingAddress(billingAddress);
|
||||
|
||||
CachedBeanData cacheData = CachedBeanDataFromBean.extract(desc, (EntityBean) customer);
|
||||
|
||||
assertEquals(cacheData.getData("id"), "42");
|
||||
assertEquals(cacheData.getData("name"), "Rob");
|
||||
assertEquals(cacheData.getData("billingAddress"), "12");
|
||||
assertEquals(cacheData.getData("anniversary"), "9223372036825200000");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void inheritance() {
|
||||
|
||||
Car car = new Car();
|
||||
car.setId(42);
|
||||
car.setDriver("Jimmy");
|
||||
car.setNotes("some notes");
|
||||
|
||||
BeanDescriptor<Car> carDesc = server.descriptor(Car.class);
|
||||
CachedBeanData cacheData = CachedBeanDataFromBean.extract(carDesc, (EntityBean) car);
|
||||
|
||||
Car newCar = new Car();
|
||||
EntityBean entityBean = (EntityBean) newCar;
|
||||
CachedBeanDataToBean.load(carDesc, entityBean, cacheData, new DefaultPersistenceContext());
|
||||
|
||||
assertEquals(newCar.getId(), car.getId());
|
||||
assertEquals(newCar.getDriver(), car.getDriver());
|
||||
assertEquals(newCar.getNotes(), car.getNotes());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void dirtyScalar_expect_originalValueUsed() {
|
||||
|
||||
Contact contact = new Contact();
|
||||
contact.setId(42);
|
||||
contact.setLastName("Bygrave");
|
||||
contact.setFirstName("Foo");
|
||||
contact.setEmail("rob@email.com");
|
||||
|
||||
EntityBean entityBean = (EntityBean)contact;
|
||||
entityBean._ebean_getIntercept().setLoaded();
|
||||
|
||||
// mutate, dirty
|
||||
contact.setLastName("Banana");
|
||||
|
||||
final BeanDescriptor<Contact> desc = server.descriptor(Contact.class);
|
||||
CachedBeanData cacheData = CachedBeanDataFromBean.extract(desc, entityBean);
|
||||
|
||||
final Map<String, Object> data = cacheData.getData();
|
||||
assertThat(data.get("id")).isEqualTo("42");
|
||||
assertThat(data.get("lastName")).isEqualTo("Bygrave"); // ORIGINAL VALUE
|
||||
assertThat(data.get("firstName")).isEqualTo(contact.getFirstName());
|
||||
assertThat(data.get("email")).isEqualTo(contact.getEmail());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dirtyManyToOne_expect_originalValueUsed() {
|
||||
|
||||
Customer customer = new Customer();
|
||||
customer.setId(99);
|
||||
|
||||
Contact contact = new Contact();
|
||||
contact.setFirstName("Foo");
|
||||
contact.setLastName("Bygrave");
|
||||
contact.setEmail("rob@email.com");
|
||||
contact.setCustomer(customer);
|
||||
|
||||
EntityBean entityBean = (EntityBean)contact;
|
||||
entityBean._ebean_getIntercept().setLoaded();
|
||||
|
||||
// mutate, dirty
|
||||
Customer customer2 = new Customer();
|
||||
customer2.setId(108);
|
||||
contact.setCustomer(customer2);
|
||||
contact.setLastName("Banana");
|
||||
|
||||
final BeanDescriptor<Contact> desc = server.descriptor(Contact.class);
|
||||
CachedBeanData cacheData = CachedBeanDataFromBean.extract(desc, entityBean);
|
||||
|
||||
final Map<String, Object> data = cacheData.getData();
|
||||
assertThat(data.get("lastName")).isEqualTo("Bygrave"); // Original value
|
||||
assertThat(data.get("customer")).isEqualTo("99"); // Original value
|
||||
assertThat(data.get("firstName")).isEqualTo(contact.getFirstName());
|
||||
assertThat(data.get("email")).isEqualTo(contact.getEmail());
|
||||
}
|
||||
}
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
package io.ebeaninternal.server.cache;
|
||||
|
||||
import io.ebean.DB;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import io.ebeaninternal.server.transaction.DefaultPersistenceContext;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.basic.Customer;
|
||||
import org.tests.model.basic.TBytesOnly;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class CachedBeanDataSerializeTest {
|
||||
|
||||
private final SpiEbeanServer db = (SpiEbeanServer)DB.getDefault();
|
||||
|
||||
@Test
|
||||
public void write() throws IOException, ClassNotFoundException {
|
||||
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("name", "rob");
|
||||
map.put("some", "thing");
|
||||
map.put("whenCreated", "" + System.currentTimeMillis());
|
||||
|
||||
long version = System.currentTimeMillis();
|
||||
CachedBeanData write = new CachedBeanData(null, "C", map, version);
|
||||
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(os);
|
||||
|
||||
write.writeExternal(oos);
|
||||
oos.flush();
|
||||
oos.close();
|
||||
|
||||
byte[] bytes = os.toByteArray();
|
||||
|
||||
ByteArrayInputStream is = new ByteArrayInputStream(bytes);
|
||||
ObjectInputStream ois = new ObjectInputStream(is);
|
||||
|
||||
CachedBeanData read = new CachedBeanData();
|
||||
read.readExternal(ois);
|
||||
|
||||
assertEquals(read.getVersion(), write.getVersion());
|
||||
assertEquals(read.getWhenCreated(), write.getWhenCreated());
|
||||
assertEquals(read.getDiscValue(), write.getDiscValue());
|
||||
assertEquals(read.getData(), write.getData());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void fullBean() throws IOException, ClassNotFoundException {
|
||||
Customer customer = new Customer();
|
||||
customer.setId(42);
|
||||
customer.setName("FooBar");
|
||||
customer.setStatus(Customer.Status.INACTIVE);
|
||||
customer.setVersion(3L);
|
||||
|
||||
BeanDescriptor<Customer> desc = db.descriptor(Customer.class);
|
||||
CachedBeanData extract = CachedBeanDataFromBean.extract(desc, (EntityBean) customer);
|
||||
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
writeToStream(extract, os);
|
||||
|
||||
byte[] bytes = os.toByteArray();
|
||||
|
||||
CachedBeanData read = readFromStream(bytes);
|
||||
|
||||
assertEquals(read.getData(), extract.getData());
|
||||
|
||||
Customer loadCustomer = new Customer();
|
||||
CachedBeanDataToBean.load(desc, (EntityBean) loadCustomer, read, new DefaultPersistenceContext());
|
||||
|
||||
assertEquals(loadCustomer.getVersion(), customer.getVersion());
|
||||
assertEquals(loadCustomer.getId(), customer.getId());
|
||||
assertEquals(loadCustomer.getName(), customer.getName());
|
||||
assertEquals(loadCustomer.getStatus(), customer.getStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void beanWithByteArray() throws IOException, ClassNotFoundException {
|
||||
|
||||
String stringContent = "ThisIsSome";
|
||||
|
||||
TBytesOnly bean = new TBytesOnly();
|
||||
bean.setId(42);
|
||||
bean.setContent(stringContent.getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
BeanDescriptor<TBytesOnly> desc = db.descriptor(TBytesOnly.class);
|
||||
CachedBeanData extract = CachedBeanDataFromBean.extract(desc, (EntityBean) bean);
|
||||
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
writeToStream(extract, os);
|
||||
byte[] bytes = os.toByteArray();
|
||||
|
||||
CachedBeanData read = readFromStream(bytes);
|
||||
byte[] extraContent = (byte[]) extract.getData("content");
|
||||
|
||||
assertEquals(stringContent, new String(extraContent));
|
||||
assertTrue(Arrays.equals(bean.getContent(), extraContent));
|
||||
|
||||
TBytesOnly loadBean = new TBytesOnly();
|
||||
CachedBeanDataToBean.load(desc, (EntityBean) loadBean, read, new DefaultPersistenceContext());
|
||||
|
||||
assertEquals(loadBean.getId(), bean.getId());
|
||||
assertTrue(Arrays.equals(loadBean.getContent(), bean.getContent()));
|
||||
}
|
||||
|
||||
private CachedBeanData readFromStream(byte[] bytes) throws IOException, ClassNotFoundException {
|
||||
|
||||
ByteArrayInputStream is = new ByteArrayInputStream(bytes);
|
||||
ObjectInputStream ois = new ObjectInputStream(is);
|
||||
return (CachedBeanData) ois.readObject();
|
||||
}
|
||||
|
||||
private void writeToStream(CachedBeanData extract, ByteArrayOutputStream os) throws IOException {
|
||||
|
||||
ObjectOutputStream oos = new ObjectOutputStream(os);
|
||||
oos.writeObject(extract);
|
||||
oos.flush();
|
||||
oos.close();
|
||||
}
|
||||
|
||||
}
|
||||
Vendored
+56
@@ -0,0 +1,56 @@
|
||||
package io.ebeaninternal.server.cache;
|
||||
|
||||
import io.ebean.cache.ServerCacheOptions;
|
||||
import io.ebean.cache.ServerCacheType;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.basic.Article;
|
||||
import org.tests.model.basic.Order;
|
||||
import org.tests.model.basic.Product;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class DefaultCacheHolder_getCacheOptions_Test {
|
||||
|
||||
private final DefaultCacheHolder cacheHolder;
|
||||
|
||||
public DefaultCacheHolder_getCacheOptions_Test() {
|
||||
|
||||
ServerCacheOptions defaultOptions = new ServerCacheOptions();
|
||||
defaultOptions.setMaxSize(10000);
|
||||
defaultOptions.setMaxSecsToLive(120);
|
||||
|
||||
CacheManagerOptions builder = new CacheManagerOptions(null, new DatabaseConfig(), true)
|
||||
.with(defaultOptions, defaultOptions);
|
||||
|
||||
this.cacheHolder = new DefaultCacheHolder(builder);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void beanOptions_when_set() {
|
||||
|
||||
ServerCacheOptions options = cacheHolder.getCacheOptions(Article.class, ServerCacheType.BEAN);
|
||||
assertEquals(options.getMaxSecsToLive(), 45);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void beanOptions_when_notSet_expect_default() {
|
||||
|
||||
ServerCacheOptions options = cacheHolder.getCacheOptions(Order.class, ServerCacheType.BEAN);
|
||||
assertEquals(options.getMaxSecsToLive(), 120);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void queryOptions_when_set() {
|
||||
|
||||
ServerCacheOptions options = cacheHolder.getCacheOptions(Product.class, ServerCacheType.QUERY);
|
||||
assertEquals(options.getMaxSecsToLive(), 15);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void queryOptions_when_notSet_expect_default() {
|
||||
|
||||
ServerCacheOptions options = cacheHolder.getCacheOptions(Order.class, ServerCacheType.QUERY);
|
||||
assertEquals(options.getMaxSecsToLive(), 120);
|
||||
}
|
||||
}
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
package io.ebeaninternal.server.cache;
|
||||
|
||||
import io.ebean.config.ContainerConfig;
|
||||
import io.ebean.config.CurrentTenantProvider;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebeaninternal.server.cluster.ClusterManager;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.basic.Contact;
|
||||
import org.tests.model.basic.Customer;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class DefaultServerCacheManagerTest {
|
||||
|
||||
private final ThreadLocal<String> tenantId = new ThreadLocal<>();
|
||||
|
||||
class TdTenPro implements CurrentTenantProvider {
|
||||
|
||||
@Override
|
||||
public Object currentId() {
|
||||
return tenantId.get();
|
||||
}
|
||||
}
|
||||
|
||||
private final ClusterManager clusterManager = new ClusterManager(new ContainerConfig());
|
||||
|
||||
private final DefaultServerCacheManager manager = new DefaultServerCacheManager(new CacheManagerOptions(clusterManager, new DatabaseConfig(), true));
|
||||
|
||||
private final DefaultServerCacheManager multiTenantManager;
|
||||
|
||||
public DefaultServerCacheManagerTest(){
|
||||
CacheManagerOptions builder = new CacheManagerOptions(clusterManager, new DatabaseConfig(), true);
|
||||
builder.with(new TdTenPro());
|
||||
this.multiTenantManager = new DefaultServerCacheManager(builder);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getCache_normal() {
|
||||
|
||||
DefaultServerCache cache = cache(manager, Customer.class);
|
||||
assertThat(cache.getName()).isEqualTo("org.tests.model.basic.Customer_B");
|
||||
assertThat(cache.getShortName()).isEqualTo("Customer_B");
|
||||
|
||||
DefaultServerCache cache1 = cache(manager, Customer.class);
|
||||
assertThat(cache1).isSameAs(cache);
|
||||
|
||||
DefaultServerCache cache2 = cache(manager, Contact.class);
|
||||
assertThat(cache1).isNotSameAs(cache2);
|
||||
assertThat(cache2.getName()).isEqualTo("org.tests.model.basic.Contact_B");
|
||||
assertThat(cache2.getShortName()).isEqualTo("Contact_B");
|
||||
|
||||
|
||||
DefaultServerCache natKeyCache = (DefaultServerCache) manager.getNaturalKeyCache(Customer.class);
|
||||
assertThat(natKeyCache.getName()).isEqualTo("org.tests.model.basic.Customer_N");
|
||||
assertThat(natKeyCache.getShortName()).isEqualTo("Customer_N");
|
||||
|
||||
DefaultServerCache queryCache = (DefaultServerCache) manager.getQueryCache(Customer.class);
|
||||
assertThat(queryCache.getName()).isEqualTo("org.tests.model.basic.Customer_Q");
|
||||
assertThat(queryCache.getShortName()).isEqualTo("Customer_Q");
|
||||
|
||||
DefaultServerCache collCache = (DefaultServerCache) manager.getCollectionIdsCache(Customer.class, "contacts");
|
||||
assertThat(collCache.getName()).isEqualTo("org.tests.model.basic.Customer.contacts_C");
|
||||
assertThat(collCache.getShortName()).isEqualTo("Customer.contacts_C");
|
||||
|
||||
cache.clearCount.reset();
|
||||
collCache.clearCount.reset();
|
||||
queryCache.clearCount.reset();
|
||||
natKeyCache.clearCount.reset();
|
||||
|
||||
manager.clear(Customer.class);
|
||||
|
||||
assertThat(cache.clearCount.get(true)).isEqualTo(1);
|
||||
assertThat(natKeyCache.clearCount.get(true)).isEqualTo(1);
|
||||
assertThat(queryCache.clearCount.get(true)).isEqualTo(1);
|
||||
assertThat(collCache.clearCount.get(true)).isEqualTo(1);
|
||||
}
|
||||
|
||||
private DefaultServerCache cache(DefaultServerCacheManager manager, Class<?> beanType) {
|
||||
return (DefaultServerCache) manager.getBeanCache(beanType);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getCache_multiTenant() {
|
||||
|
||||
tenantId.set("ten1");
|
||||
DefaultServerCache cache = cache(multiTenantManager, Customer.class);
|
||||
assertThat(cache.getName()).isEqualTo("org.tests.model.basic.Customer_B");
|
||||
cache.put("1", "tenant1");
|
||||
|
||||
tenantId.set("ten2");
|
||||
|
||||
assertThat(cache.get("1")).isNull();
|
||||
|
||||
tenantId.set("ten1");
|
||||
|
||||
assertThat(cache.get("1")).isNotNull();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getCache_singleTenant() {
|
||||
|
||||
tenantId.set("ten1");
|
||||
DefaultServerCache cache = cache(manager, Customer.class);
|
||||
assertThat(cache.getName()).isEqualTo("org.tests.model.basic.Customer_B");
|
||||
|
||||
cache.put("1", "tenant1");
|
||||
|
||||
tenantId.set("ten2");
|
||||
|
||||
assertThat(cache.get("1")).isEqualTo("tenant1");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isLocalL2Caching() {
|
||||
|
||||
assertTrue(manager.isLocalL2Caching());
|
||||
assertTrue(multiTenantManager.isLocalL2Caching());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package org.tests.model.basic;
|
||||
|
||||
import io.ebean.annotation.Cache;
|
||||
import io.ebean.annotation.CacheBeanTuning;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.OneToMany;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Cache
|
||||
@CacheBeanTuning(maxSecsToLive = 45)
|
||||
@Entity
|
||||
public class Article extends BasicDomain {
|
||||
private static final long serialVersionUID = -7181090513848918784L;
|
||||
|
||||
String name;
|
||||
|
||||
String author;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
List<Section> sections;
|
||||
|
||||
public Article(String name, String author) {
|
||||
this.name = name;
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
public void setAuthor(String author) {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
public List<Section> getSections() {
|
||||
return sections;
|
||||
}
|
||||
|
||||
public void setSections(List<Section> sections) {
|
||||
this.sections = sections;
|
||||
}
|
||||
|
||||
public void addSection(Section s) {
|
||||
if (sections == null) {
|
||||
sections = new ArrayList<>();
|
||||
}
|
||||
sections.add(s);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package org.tests.model.basic;
|
||||
|
||||
import io.ebean.annotation.DbEnumValue;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@Entity
|
||||
@Inheritance
|
||||
@DiscriminatorValue("C")
|
||||
public class Car extends Vehicle {
|
||||
private static final long serialVersionUID = -65427345082456523L;
|
||||
|
||||
public enum Size {
|
||||
SMALL("S"),
|
||||
LARGE("L");
|
||||
|
||||
String value;
|
||||
|
||||
Size(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@DbEnumValue
|
||||
public String value() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@Column(name = "siz")
|
||||
private Size size;
|
||||
|
||||
private String driver;
|
||||
|
||||
@ManyToOne
|
||||
private TruckRef carRef;
|
||||
|
||||
@OneToMany(mappedBy = "car")
|
||||
@OrderBy("fuse.locationCode")
|
||||
private Set<CarAccessory> accessories = new HashSet<>();
|
||||
|
||||
private String notes;
|
||||
|
||||
public String getDriver() {
|
||||
return driver;
|
||||
}
|
||||
|
||||
public void setDriver(String driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public String getNotes() {
|
||||
return notes;
|
||||
}
|
||||
|
||||
public void setNotes(String notes) {
|
||||
this.notes = notes;
|
||||
}
|
||||
|
||||
public TruckRef getCarRef() {
|
||||
return carRef;
|
||||
}
|
||||
|
||||
public void setCarRef(TruckRef carRef) {
|
||||
this.carRef = carRef;
|
||||
}
|
||||
|
||||
public Set<CarAccessory> getAccessories() {
|
||||
return accessories;
|
||||
}
|
||||
|
||||
public void setAccessories(Set<CarAccessory> accessories) {
|
||||
this.accessories = accessories;
|
||||
}
|
||||
|
||||
public Size getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(Size size) {
|
||||
this.size = size;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.tests.model.basic;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.ManyToOne;
|
||||
|
||||
@Entity
|
||||
public class CarAccessory extends BasicDomain {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String name;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
private CarFuse fuse;
|
||||
|
||||
@ManyToOne
|
||||
private Car car;
|
||||
|
||||
public CarAccessory(Car car, CarFuse fuse) {
|
||||
this.car = car;
|
||||
this.fuse = fuse;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Car getCar() {
|
||||
return car;
|
||||
}
|
||||
|
||||
public void setCar(Car car) {
|
||||
this.car = car;
|
||||
}
|
||||
|
||||
public CarFuse getFuse() {
|
||||
return fuse;
|
||||
}
|
||||
|
||||
public void setFuse(CarFuse fuse) {
|
||||
this.fuse = fuse;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.tests.model.basic;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity
|
||||
public class CarFuse {
|
||||
|
||||
@Id
|
||||
Long id;
|
||||
|
||||
String locationCode;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLocationCode() {
|
||||
return locationCode;
|
||||
}
|
||||
|
||||
public void setLocationCode(String locationCode) {
|
||||
this.locationCode = locationCode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package org.tests.model.basic;
|
||||
|
||||
import io.ebean.annotation.Cache;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Cache
|
||||
@Entity
|
||||
public class Section extends BasicDomain {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public enum Type {
|
||||
GENERAL,
|
||||
NOTE
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
Article article;
|
||||
|
||||
Type type = Type.GENERAL;
|
||||
|
||||
@Lob
|
||||
String content;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
List<SubSection> subSections;
|
||||
|
||||
public Section() {
|
||||
}
|
||||
|
||||
public Section(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public Article getArticle() {
|
||||
return article;
|
||||
}
|
||||
|
||||
public void setArticle(Article article) {
|
||||
this.article = article;
|
||||
}
|
||||
|
||||
public List<SubSection> getSubSections() {
|
||||
return subSections;
|
||||
}
|
||||
|
||||
public void setSubSections(List<SubSection> subSections) {
|
||||
this.subSections = subSections;
|
||||
}
|
||||
|
||||
public void addSubSection(SubSection s) {
|
||||
if (subSections == null) {
|
||||
subSections = new ArrayList<>();
|
||||
}
|
||||
subSections.add(s);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package org.tests.model.basic;
|
||||
|
||||
import io.ebean.annotation.Cache;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.ManyToOne;
|
||||
|
||||
@Cache
|
||||
@Entity
|
||||
public class SubSection extends BasicDomain {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ManyToOne
|
||||
private Section section;
|
||||
|
||||
private String title;
|
||||
|
||||
public SubSection() {
|
||||
}
|
||||
|
||||
public SubSection(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package org.tests.model.basic;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Entity
|
||||
public class TBytesOnly {
|
||||
|
||||
@Id
|
||||
Integer id;
|
||||
|
||||
@Lob
|
||||
@Basic(fetch = FetchType.EAGER)
|
||||
byte[] content;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public byte[] getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(byte[] content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package org.tests.model.basic;
|
||||
|
||||
import io.ebean.annotation.DbEnumValue;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Entity
|
||||
@Inheritance
|
||||
@DiscriminatorValue("T")
|
||||
public class Truck extends Vehicle {
|
||||
private static final long serialVersionUID = 9195535931523211134L;
|
||||
|
||||
public enum Size {
|
||||
SMALL("S"),
|
||||
MEDIUM("M"),
|
||||
LARGE("L"),
|
||||
HUGE("H");
|
||||
|
||||
String value;
|
||||
|
||||
Size(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@DbEnumValue(length = 3)
|
||||
public String value() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@Column(name = "siz")
|
||||
private Size size;
|
||||
|
||||
@ManyToOne
|
||||
TruckRef truckRef;
|
||||
|
||||
private Double capacity;
|
||||
|
||||
public Double getCapacity() {
|
||||
return capacity;
|
||||
}
|
||||
|
||||
public void setCapacity(Double capacity) {
|
||||
this.capacity = capacity;
|
||||
}
|
||||
|
||||
public TruckRef getTruckRef() {
|
||||
return truckRef;
|
||||
}
|
||||
|
||||
public void setTruckRef(TruckRef truckRef) {
|
||||
this.truckRef = truckRef;
|
||||
}
|
||||
|
||||
public Size getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(Size size) {
|
||||
this.size = size;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package org.tests.model.basic;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity
|
||||
public class TruckRef {
|
||||
|
||||
@Id
|
||||
Integer id;
|
||||
|
||||
String something;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getSomething() {
|
||||
return something;
|
||||
}
|
||||
|
||||
public void setSomething(String something) {
|
||||
this.something = something;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package org.tests.model.basic;
|
||||
|
||||
import javax.persistence.DiscriminatorColumn;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Inheritance;
|
||||
import javax.persistence.ManyToOne;
|
||||
import java.util.Date;
|
||||
|
||||
@Entity
|
||||
@Inheritance
|
||||
@DiscriminatorColumn(length = 3)
|
||||
public abstract class Vehicle extends BasicDomain {
|
||||
|
||||
private static final long serialVersionUID = -3060920549470002030L;
|
||||
|
||||
private String licenseNumber;
|
||||
|
||||
private Date registrationDate;
|
||||
|
||||
// @Transient
|
||||
private transient String testTransient;
|
||||
|
||||
@ManyToOne
|
||||
private VehicleLease lease;
|
||||
|
||||
public String getLicenseNumber() {
|
||||
return licenseNumber;
|
||||
}
|
||||
|
||||
public void setLicenseNumber(String licenseNumber) {
|
||||
this.licenseNumber = licenseNumber;
|
||||
}
|
||||
|
||||
public Date getRegistrationDate() {
|
||||
return registrationDate;
|
||||
}
|
||||
|
||||
public void setRegistrationDate(Date registrationDate) {
|
||||
this.registrationDate = registrationDate;
|
||||
}
|
||||
|
||||
public String getTestTransient() {
|
||||
return testTransient;
|
||||
}
|
||||
|
||||
public void setTestTransient(String testTransient) {
|
||||
this.testTransient = testTransient;
|
||||
}
|
||||
|
||||
public VehicleLease getLease() {
|
||||
return lease;
|
||||
}
|
||||
|
||||
public void setLease(VehicleLease lease) {
|
||||
this.lease = lease;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package org.tests.model.basic;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.ManyToOne;
|
||||
import java.util.Date;
|
||||
|
||||
@Entity
|
||||
public class VehicleDriver extends BasicDomain {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String name;
|
||||
|
||||
@ManyToOne(optional = true)
|
||||
private Vehicle vehicle;
|
||||
|
||||
@ManyToOne(optional = true)
|
||||
private Address address;
|
||||
|
||||
private Date licenseIssuedOn;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Vehicle getVehicle() {
|
||||
return vehicle;
|
||||
}
|
||||
|
||||
public void setVehicle(Vehicle vehicle) {
|
||||
this.vehicle = vehicle;
|
||||
}
|
||||
|
||||
public Address getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(Address address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public Date getLicenseIssuedOn() {
|
||||
return licenseIssuedOn;
|
||||
}
|
||||
|
||||
public void setLicenseIssuedOn(Date licenseIssuedOn) {
|
||||
this.licenseIssuedOn = licenseIssuedOn;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package org.tests.model.basic;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Inheritance;
|
||||
import javax.persistence.Version;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Entity
|
||||
@Inheritance
|
||||
public abstract class VehicleLease {
|
||||
|
||||
@Id
|
||||
long id;
|
||||
|
||||
String name;
|
||||
|
||||
LocalDate activeStart;
|
||||
|
||||
LocalDate activeEnd;
|
||||
|
||||
@Version
|
||||
long version;
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public long getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(long version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public LocalDate getActiveStart() {
|
||||
return activeStart;
|
||||
}
|
||||
|
||||
public void setActiveStart(LocalDate activeStart) {
|
||||
this.activeStart = activeStart;
|
||||
}
|
||||
|
||||
public LocalDate getActiveEnd() {
|
||||
return activeEnd;
|
||||
}
|
||||
|
||||
public void setActiveEnd(LocalDate activeEnd) {
|
||||
this.activeEnd = activeEnd;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package org.tests.model.basic;
|
||||
|
||||
import javax.persistence.DiscriminatorValue;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Inheritance;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Entity
|
||||
@Inheritance
|
||||
@DiscriminatorValue("LONG")
|
||||
public class VehicleLeaseLong extends VehicleLease {
|
||||
|
||||
BigDecimal bond;
|
||||
|
||||
int minDuration;
|
||||
|
||||
public BigDecimal getBond() {
|
||||
return bond;
|
||||
}
|
||||
|
||||
public void setBond(BigDecimal bond) {
|
||||
this.bond = bond;
|
||||
}
|
||||
|
||||
public int getMinDuration() {
|
||||
return minDuration;
|
||||
}
|
||||
|
||||
public void setMinDuration(int minDuration) {
|
||||
this.minDuration = minDuration;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.tests.model.basic;
|
||||
|
||||
import javax.persistence.DiscriminatorValue;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Inheritance;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Entity
|
||||
@Inheritance
|
||||
@DiscriminatorValue("SHORT")
|
||||
public class VehicleLeaseShort extends VehicleLease {
|
||||
|
||||
|
||||
BigDecimal dayRate;
|
||||
|
||||
Integer maxDays;
|
||||
|
||||
public BigDecimal getDayRate() {
|
||||
return dayRate;
|
||||
}
|
||||
|
||||
public void setDayRate(BigDecimal dayRate) {
|
||||
this.dayRate = dayRate;
|
||||
}
|
||||
|
||||
public Integer getMaxDays() {
|
||||
return maxDays;
|
||||
}
|
||||
|
||||
public void setMaxDays(Integer maxDays) {
|
||||
this.maxDays = maxDays;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package org.tests.model.embedded;
|
||||
|
||||
import io.ebean.annotation.DbJson;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embeddable;
|
||||
import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
import java.util.Map;
|
||||
|
||||
@Embeddable
|
||||
public class EAddress {
|
||||
|
||||
@Column(nullable = false)
|
||||
String street;
|
||||
|
||||
String suburb;
|
||||
|
||||
String city;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
EAddressStatus status;
|
||||
|
||||
// @DbJson
|
||||
// PlainBean jbean;
|
||||
|
||||
@DbJson
|
||||
Map<String, Object> jraw;
|
||||
|
||||
public String getStreet() {
|
||||
return street;
|
||||
}
|
||||
|
||||
public void setStreet(String street) {
|
||||
this.street = street;
|
||||
}
|
||||
|
||||
public String getSuburb() {
|
||||
return suburb;
|
||||
}
|
||||
|
||||
public void setSuburb(String suburb) {
|
||||
this.suburb = suburb;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
// public PlainBean getJbean() {
|
||||
// return jbean;
|
||||
// }
|
||||
//
|
||||
// public void setJbean(PlainBean jbean) {
|
||||
// this.jbean = jbean;
|
||||
// }
|
||||
|
||||
public Map<String, Object> getJraw() {
|
||||
return jraw;
|
||||
}
|
||||
|
||||
public void setJraw(Map<String, Object> jraw) {
|
||||
this.jraw = jraw;
|
||||
}
|
||||
|
||||
public EAddressStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(EAddressStatus status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.tests.model.embedded;
|
||||
|
||||
public enum EAddressStatus {
|
||||
|
||||
ONE("One") {
|
||||
@Override
|
||||
public String doIt() {
|
||||
return 10 + name;
|
||||
}
|
||||
},
|
||||
TWO("Two") {
|
||||
@Override
|
||||
public String doIt() {
|
||||
return 20 + name;
|
||||
}
|
||||
};
|
||||
|
||||
String name;
|
||||
|
||||
EAddressStatus(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public abstract String doIt();
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package org.tests.model.embedded;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Entity
|
||||
public class EPerson {
|
||||
|
||||
@Id
|
||||
Long id;
|
||||
|
||||
@Version
|
||||
Long version;
|
||||
|
||||
String name;
|
||||
|
||||
String notes;
|
||||
|
||||
@Embedded
|
||||
@AttributeOverrides({
|
||||
@AttributeOverride(name = "city", column = @Column(name = "addr_city")),
|
||||
@AttributeOverride(name = "status", column = @Column(name = "addr_status")),
|
||||
@AttributeOverride(name = "jbean", column = @Column(name = "addr_jbean"))
|
||||
})
|
||||
EAddress address;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(Long version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getNotes() {
|
||||
return notes;
|
||||
}
|
||||
|
||||
public void setNotes(String notes) {
|
||||
this.notes = notes;
|
||||
}
|
||||
|
||||
public EAddress getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(EAddress address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user