Created
October 29, 2013 18:30
-
-
Save johnrengelman/7220090 to your computer and use it in GitHub Desktop.
Custom H2 Hibernate Dialect to support differences in MySQL and H2 query syntax
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.hibernate.dialect.H2Dialect | |
import org.hibernate.dialect.function.SQLFunctionTemplate | |
import org.hibernate.type.StandardBasicTypes | |
class H2MysqlSupportDialect extends H2Dialect { | |
H2MysqlSupportDialect() { | |
registerFunction('datediff', new SQLFunctionTemplate(StandardBasicTypes.DATE, "datediff('DAY', ?2, ?1)")) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment