mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-14 06:45:21 +00:00
Support H2database 2.x
This commit is contained in:
1 parent
8d29a3a575
commit
a9dbc036e9
12 files changed
+30
-13
No files matched your search
+2
-1
@@ -10,6 +10,7 @@ final class H2DbExpression extends BasicDbExpression {
|
||||
|
||||
@Override
|
||||
public void bitwise(SpiExpressionRequest request, String propName, BitwiseOp operator, long flags, String compare, long match) {
|
||||
bitwiseFunction(request, propName, operator, compare);
|
||||
String funcName = functionName(operator);
|
||||
request.append(funcName).append("(").append(propName).append(", cast(? as long)) ").append(compare).append(" cast(? as long)");
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,14 @@ final class EnumToDbIntegerMap extends EnumToDbValueMap<Integer> {
|
||||
addInternal(beanValue, dbValue, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getBeanValue(Object dbValue) {
|
||||
if (dbValue instanceof String) {
|
||||
return super.getBeanValue(Integer.parseInt(dbValue.toString()));
|
||||
}
|
||||
return super.getBeanValue(dbValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumToDbIntegerMap add(Object beanValue, String stringDbValue, String name) {
|
||||
try {
|
||||
|
||||
@@ -116,7 +116,8 @@ abstract class EnumToDbValueMap<T> {
|
||||
/**
|
||||
* Return the Bean value given the DB value.
|
||||
*/
|
||||
public Object getBeanValue(T dbValue) {
|
||||
@SuppressWarnings("SuspiciousMethodCalls")
|
||||
public Object getBeanValue(Object dbValue) {
|
||||
if (dbValue == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -125,8 +126,7 @@ abstract class EnumToDbValueMap<T> {
|
||||
beanValue = nameMap.get(dbValue);
|
||||
}
|
||||
if (beanValue == null && !allowNulls) {
|
||||
String msg = "Bean value for " + dbValue + " not found in " + valueMap;
|
||||
throw new IllegalArgumentException(msg);
|
||||
throw new IllegalArgumentException("Bean value for " + dbValue + " not found in " + valueMap);
|
||||
}
|
||||
return beanValue;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user