mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Fix for #173 - Ability to use a MappedSuperClass without being enhanced as long as it doesn't have persistent fields
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package com.avaje.ebeaninternal.server.deploy;
|
||||
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.tests.model.basic.ResetBasicData;
|
||||
import com.avaje.tests.model.mappedsuper.ASimpleBean;
|
||||
|
||||
public class TestNotEnhancedMappedSuper extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void simpleBean_mappedSuperNotEnhanced_ok() {
|
||||
|
||||
// //GlobalProperties.put("ebean.search.packages", "com.avaje.tests.model.mappedsuper");
|
||||
|
||||
ResetBasicData.reset();
|
||||
|
||||
ASimpleBean bean = new ASimpleBean();
|
||||
bean.setName("junk");
|
||||
|
||||
Ebean.save(bean);
|
||||
|
||||
Assert.assertNotNull(bean.getId());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.avaje.tests.model.mappedsuper;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity
|
||||
public class ASimpleBean extends NotEnhancedMappedSuper {
|
||||
|
||||
@Id
|
||||
Long id;
|
||||
|
||||
String name;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.avaje.tests.model.mappedsuper;
|
||||
|
||||
import javax.persistence.MappedSuperclass;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
@MappedSuperclass
|
||||
public abstract class NotEnhancedMappedSuper {
|
||||
|
||||
public static String SOMETHING = "Hello";
|
||||
|
||||
private transient Long one;
|
||||
|
||||
@Transient
|
||||
private Long two;
|
||||
|
||||
public Long getOne() {
|
||||
return one;
|
||||
}
|
||||
|
||||
public void setOne(Long one) {
|
||||
this.one = one;
|
||||
}
|
||||
|
||||
public Long getTwo() {
|
||||
return two;
|
||||
}
|
||||
|
||||
public void setTwo(Long two) {
|
||||
this.two = two;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user