Skip to content

Instantly share code, notes, and snippets.

@sebersole
Created May 7, 2013 19:34
Show Gist options
  • Save sebersole/5535457 to your computer and use it in GitHub Desktop.
Save sebersole/5535457 to your computer and use it in GitHub Desktop.
"so hard"
class MyDialectResolver implements DialectResolver {
public Dialect resolveDialect(DatabaseMetaData metaData) {
if ( "H2".equals( metaData.getDatabaseProductName ) ) {
return MyH2Dialect.INSTANCE;
}
else if ( "PostgreSQL".equals( metaData.getDatabaseProductName ) ) {
return MyPgsqlDialect.INSTANCE;
}
return null;
}
}
class MyH2Dialect extends H2Dialect {
public static final MyH2Dialect INSTANCE = new MyH2Dialect();
private MyH2Dialect() {
super();
registerFunction( "datediff", ... );
}
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment