mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-09 08:42:18 +00:00
WIP h2database v2
This commit is contained in:
1 parent
6cc5e83b01
commit
860aad11ce
14 files changed
+37
-22
No files matched your search
+1
-1
@@ -78,7 +78,7 @@
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>1.4.199</version>
|
||||
<version>2.0.202</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import io.ebeaninternal.server.deploy.InheritInfo;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
|
||||
|
||||
import javax.persistence.DiscriminatorColumn;
|
||||
import javax.persistence.DiscriminatorType;
|
||||
import javax.persistence.DiscriminatorValue;
|
||||
import javax.persistence.Inheritance;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -105,8 +106,11 @@ public final class DeployInherit {
|
||||
if (da != null) {
|
||||
// lowercase the discriminator column for RawSql and JSON
|
||||
info.setColumnName(da.name().toLowerCase());
|
||||
info.setColumnType(da.discriminatorType());
|
||||
info.setColumnLength(da.length());
|
||||
DiscriminatorType discriminatorType = da.discriminatorType();
|
||||
info.setColumnType(discriminatorType);
|
||||
if (discriminatorType == DiscriminatorType.STRING) {
|
||||
info.setColumnLength(da.length());
|
||||
}
|
||||
info.setColumnDefn(da.columnDefinition());
|
||||
}
|
||||
if (!info.isAbstract()) {
|
||||
|
||||
@@ -189,7 +189,12 @@ final class ScalarTypeEnumStandard {
|
||||
if (dbValue == null || dbValue instanceof Enum<?>) {
|
||||
return dbValue;
|
||||
}
|
||||
int ordinal = (Integer) dbValue;
|
||||
int ordinal;
|
||||
if (dbValue instanceof Integer) {
|
||||
ordinal = (Integer) dbValue;
|
||||
} else {
|
||||
ordinal = Integer.parseInt(dbValue.toString());
|
||||
}
|
||||
if (ordinal < 0 || ordinal >= enumArray.length) {
|
||||
String m = "Unexpected ordinal [" + ordinal + "] out of range [" + enumArray.length + "]";
|
||||
throw new IllegalStateException(m);
|
||||
|
||||
Reference in new issue
Block a user