public static Dialect determineDialect ( String databaseName , String databaseMajorVersion ) throws DialectException { if ( databaseName == null ) { throw new DialectException ( "Dialect must be explicitly set" ) ; } String dialectName ; // TODO workaround for firebird (databaseName='Firebird 2.0.LI-V2.0.3.12981 Firebird 2.0/tcp (decebal)/P10') if ( databaseName . startsWith ( FIREBIRD ) ) { dialectName = FirebirdDialect . class . getName ( ) ; } else if ( databaseName . startsWith ( MSACCESS ) ) { dialectName = MSAccessDialect . class . getName ( ) ; } else { DialectMapper mapper = MAPPERS . get ( databaseName ) ; if ( mapper == null ) { throw new DialectException ( "Dialect must be explicitly set for database: " + databaseName ) ; } dialectName = mapper . getDialectClass ( databaseMajorVersion ) ; } return buildDialect ( dialectName ) ; }
Determine the appropriate Dialect to use given the database product name and major version .