mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-28 23:28:55 +00:00
#513 - Column Constraint for Enum types should cover all Enum values in an inheritance hierachy
This commit is contained in:
1 parent
4606c7c99f
commit
db8dd48e53
9 files changed
+133
-70
No files matched your search
@@ -1,5 +1,7 @@
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import com.avaje.ebean.annotation.DbEnumValue;
|
||||
|
||||
import javax.persistence.DiscriminatorValue;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Inheritance;
|
||||
@@ -14,7 +16,22 @@ import java.util.Set;
|
||||
@DiscriminatorValue("C")
|
||||
public class Car extends Vehicle {
|
||||
|
||||
private static final long serialVersionUID = 4716705779684333446L;
|
||||
public enum Size {
|
||||
SMALL("S"),
|
||||
LARGE("L");
|
||||
|
||||
String value;
|
||||
Size(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@DbEnumValue
|
||||
public String value() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
private Size size;
|
||||
|
||||
private String driver;
|
||||
|
||||
@@ -58,4 +75,12 @@ public class Car extends Vehicle {
|
||||
public void setAccessories(Set<CarAccessory> accessories) {
|
||||
this.accessories = accessories;
|
||||
}
|
||||
|
||||
public Size getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(Size size) {
|
||||
this.size = size;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user