diff --git a/ebean-api/pom.xml b/ebean-api/pom.xml
index b681c1a70..872acf7d4 100644
--- a/ebean-api/pom.xml
+++ b/ebean-api/pom.xml
@@ -85,7 +85,7 @@
com.h2database
h2
- 2.0.202
+ 2.1.210
true
diff --git a/ebean-core/pom.xml b/ebean-core/pom.xml
index af55c2c6a..2c3ff4ec4 100644
--- a/ebean-core/pom.xml
+++ b/ebean-core/pom.xml
@@ -78,7 +78,7 @@
com.h2database
h2
- 2.0.202
+ 2.1.210
provided
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/expression/platform/H2DbExpression.java b/ebean-core/src/main/java/io/ebeaninternal/server/expression/platform/H2DbExpression.java
index 5eddb5d11..60cb180d3 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/expression/platform/H2DbExpression.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/expression/platform/H2DbExpression.java
@@ -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)");
}
}
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/type/EnumToDbIntegerMap.java b/ebean-core/src/main/java/io/ebeaninternal/server/type/EnumToDbIntegerMap.java
index 2e2d2cc31..5f34e31fe 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/type/EnumToDbIntegerMap.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/type/EnumToDbIntegerMap.java
@@ -34,6 +34,14 @@ final class EnumToDbIntegerMap extends EnumToDbValueMap {
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 {
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/type/EnumToDbValueMap.java b/ebean-core/src/main/java/io/ebeaninternal/server/type/EnumToDbValueMap.java
index 92ebc9334..5ff0f9ed6 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/type/EnumToDbValueMap.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/type/EnumToDbValueMap.java
@@ -116,7 +116,8 @@ abstract class EnumToDbValueMap {
/**
* 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 {
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;
}
diff --git a/ebean-querybean/src/test/resources/application-test.properties b/ebean-querybean/src/test/resources/application-test.properties
index 76f2d661f..5b7b35ed3 100644
--- a/ebean-querybean/src/test/resources/application-test.properties
+++ b/ebean-querybean/src/test/resources/application-test.properties
@@ -6,8 +6,8 @@ datasource.default=h2
datasource.h2.username=sa
datasource.h2.password=
-datasource.h2.databaseUrl=jdbc:h2:mem:tests
+datasource.h2.databaseUrl=jdbc:h2:mem:tests;NON_KEYWORDS=KEY
datasource.pg.username=sa
datasource.pg.password=
-datasource.pg.databaseUrl=jdbc:h2:mem:tests
+datasource.pg.databaseUrl=jdbc:h2:mem:tests;NON_KEYWORDS=KEY
diff --git a/ebean-test/pom.xml b/ebean-test/pom.xml
index f0fb26900..b5940bab0 100644
--- a/ebean-test/pom.xml
+++ b/ebean-test/pom.xml
@@ -76,7 +76,7 @@
com.h2database
h2
- 2.0.202
+ 2.1.210
diff --git a/ebean-test/src/test/java/io/ebean/config/PlatformNoGeneratedKeysTest.java b/ebean-test/src/test/java/io/ebean/config/PlatformNoGeneratedKeysTest.java
index 9d600fc56..6c57e56bb 100644
--- a/ebean-test/src/test/java/io/ebean/config/PlatformNoGeneratedKeysTest.java
+++ b/ebean-test/src/test/java/io/ebean/config/PlatformNoGeneratedKeysTest.java
@@ -101,7 +101,7 @@ public class PlatformNoGeneratedKeysTest {
config.setDatabasePlatform(platform);
config.getDataSourceConfig().setUsername("sa");
config.getDataSourceConfig().setPassword("");
- config.getDataSourceConfig().setUrl("jdbc:h2:mem:withPCQuery;");
+ config.getDataSourceConfig().setUrl("jdbc:h2:mem:withPCQuery;MODE=LEGACY");
config.getDataSourceConfig().setDriver("org.h2.Driver");
config.setDisableLazyLoading(true);
diff --git a/ebean-test/src/test/java/io/ebeaninternal/server/type/ScalarTypeLocalDateTest.java b/ebean-test/src/test/java/io/ebeaninternal/server/type/ScalarTypeLocalDateTest.java
index 076bad958..da18e2a3c 100644
--- a/ebean-test/src/test/java/io/ebeaninternal/server/type/ScalarTypeLocalDateTest.java
+++ b/ebean-test/src/test/java/io/ebeaninternal/server/type/ScalarTypeLocalDateTest.java
@@ -47,6 +47,14 @@ public class ScalarTypeLocalDateTest {
assertTrue(o instanceof Date);
}
+ @Test
+ public void olderDates_ToFromJdbcType() {
+ LocalDate localDate = LocalDate.of(1850,12,1);
+ Object o = type.toJdbcType(localDate);
+ LocalDate localDate1 = type.toBeanType(o);
+ assertThat(localDate1).isEqualTo(localDate);
+ }
+
@Test
public void testToBeanType() {
diff --git a/ebean-test/src/test/java/org/tests/update/TestSqlUpdateUpsert.java b/ebean-test/src/test/java/org/tests/update/TestSqlUpdateUpsert.java
index 9cd59bf23..515540ea3 100644
--- a/ebean-test/src/test/java/org/tests/update/TestSqlUpdateUpsert.java
+++ b/ebean-test/src/test/java/org/tests/update/TestSqlUpdateUpsert.java
@@ -39,7 +39,7 @@ public class TestSqlUpdateUpsert extends BaseTestCase {
.setParameter("online", false);
Object key2 = sqlUpdate2.executeGetKey();
- assertThat(key2).isNull();
+ assertThat(key2).isEqualTo(key);
EPersonOnline found2 = DB.find(EPersonOnline.class).where().eq("email", email).findOne();
diff --git a/ebean-test/src/test/resources/test-ebean.properties b/ebean-test/src/test/resources/test-ebean.properties
index 2405e5104..436499c1b 100644
--- a/ebean-test/src/test/resources/test-ebean.properties
+++ b/ebean-test/src/test/resources/test-ebean.properties
@@ -8,5 +8,5 @@ ebean.jodaLocalTimeMode=normal
datasource.someotherdb.username=sa
datasource.someotherdb.password=
-datasource.someotherdb.databaseUrl=jdbc:h2:mem:someotherdb
+datasource.someotherdb.databaseUrl=jdbc:h2:mem:someotherdb;NON_KEYWORDS=KEY,VALUE
datasource.someotherdb.databaseDriver=org.h2.Driver
diff --git a/pom.xml b/pom.xml
index fc3905d89..e7de38588 100644
--- a/pom.xml
+++ b/pom.xml
@@ -68,7 +68,7 @@
com.h2database
h2
- 2.0.202
+ 2.1.210
test