prefer localtime, localtimestamp on H2 1.4.200
As suggested by @famod we need to use localtime instead or current_time because of changes in H2. See https://github.com/hibernate/hibernate-orm/pull/3412
This commit is contained in:
parent
ab5d350805
commit
9d33bc39fb
|
@ -67,6 +67,7 @@ public class H2Dialect extends Dialect {
|
|||
private final LimitHandler limitHandler;
|
||||
|
||||
private final boolean cascadeConstraints;
|
||||
private final boolean useLocalTime;
|
||||
|
||||
private final int version;
|
||||
|
||||
|
@ -101,6 +102,8 @@ public class H2Dialect extends Dialect {
|
|||
supportsTuplesInSubqueries = version >= 104198;
|
||||
// Prior to 1.4.200 the 'cascade' in 'drop table' was implicit
|
||||
cascadeConstraints = version >= 104200;
|
||||
// 1.4.200 introduced changes in current_time and current_timestamp
|
||||
useLocalTime = version >= 140199;
|
||||
|
||||
getDefaultProperties().setProperty( AvailableSettings.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE );
|
||||
// http://code.google.com/p/h2database/issues/detail?id=235
|
||||
|
@ -191,6 +194,21 @@ public class H2Dialect extends Dialect {
|
|||
CommonFunctionFactory.rownum( queryEngine );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String currentTime() {
|
||||
return useLocalTime ? "localtime" : super.currentTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String currentTimestamp() {
|
||||
return useLocalTime ? "localtimestamp" : super.currentTimestamp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String currentTimestampWithTimeZone() {
|
||||
return "current_timestamp";
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqlAstTranslatorFactory getSqlAstTranslatorFactory() {
|
||||
return new StandardSqlAstTranslatorFactory() {
|
||||
|
|
Loading…
Reference in New Issue