Created
          May 7, 2013 19:34 
        
      - 
      
- 
        Save sebersole/5535457 to your computer and use it in GitHub Desktop. 
    "so hard"
  
        
  
    
      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
    
  
  
    
  | 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