mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#436 - @DiscriminatorColumn mapped also as @Column leads to NullPointerException
This commit is contained in:
@@ -1,10 +1,5 @@
|
||||
package com.avaje.tests.inheritance;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.ebean.bean.BeanCollection.ModifyListenMode;
|
||||
@@ -13,6 +8,11 @@ import com.avaje.tests.model.basic.Animal;
|
||||
import com.avaje.tests.model.basic.AnimalShelter;
|
||||
import com.avaje.tests.model.basic.Cat;
|
||||
import com.avaje.tests.model.basic.Dog;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
public class TestInheritanceOnMany extends BaseTestCase {
|
||||
|
||||
@@ -40,8 +40,9 @@ public class TestInheritanceOnMany extends BaseTestCase {
|
||||
BeanList<?> beanList = (BeanList<?>)animals;
|
||||
ModifyListenMode modifyListenMode = beanList.getModifyListenMode();
|
||||
|
||||
Assert.assertNotNull(modifyListenMode);
|
||||
|
||||
assertNotNull(modifyListenMode);
|
||||
|
||||
assertNotNull(Ebean.find(Animal.class).findList());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.DiscriminatorColumn;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
@@ -21,6 +22,9 @@ public abstract class Animal {
|
||||
@Version
|
||||
Long version;
|
||||
|
||||
@Column(name="species", insertable = false, updatable = false, nullable = false)
|
||||
String species;
|
||||
|
||||
@ManyToOne
|
||||
AnimalShelter shelter;
|
||||
|
||||
@@ -40,6 +44,14 @@ public abstract class Animal {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getSpecies() {
|
||||
return species;
|
||||
}
|
||||
|
||||
public void setSpecies(String species) {
|
||||
this.species = species;
|
||||
}
|
||||
|
||||
public AnimalShelter getShelter() {
|
||||
return shelter;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user