After 2 days searching for the error i found it and unfortunatly i can not fix it, cause it's in org.hibernate.cfg.SettingsFactory.
The root of my prob is, that i have to use a jdbc driver that does not support meta.getDatabaseMajorVersion().
Because of that, the code in SettingsFactory.buildSettings produces a NullpointerException:
Code:
try {
Connection conn = connections.getConnection();
try {
DatabaseMetaData meta = conn.getMetaData();
log.info( "Database ->\n" +
" name : " + meta.getDatabaseProductName() + '\n' +
" version : " + meta.getDatabaseProductVersion() + '\n' +
" major : " + meta.getDatabaseMajorVersion() + '\n' +
" minor : " + meta.getDatabaseMinorVersion()
);
log.info( "Driver ->\n" +
" name : " + meta.getDriverName() + '\n' +
" version : " + meta.getDriverVersion() + '\n' +
" major : " + meta.getDriverMajorVersion() + '\n' +
" minor : " + meta.getDriverMinorVersion()
);
dialect = DialectFactory.buildDialect( props, conn );
jdbcSupport = JdbcSupportLoader.loadJdbcSupport( conn );
metaSupportsScrollable = meta.supportsResultSetType( ResultSet.TYPE_SCROLL_INSENSITIVE );
metaSupportsBatchUpdates = meta.supportsBatchUpdates();
metaReportsDDLCausesTxnCommit = meta.dataDefinitionCausesTransactionCommit();
metaReportsDDLInTxnSupported = !meta.dataDefinitionIgnoredInTransactions();
metaSupportsGetGeneratedKeys = meta.supportsGetGeneratedKeys();
}
catch ( SQLException sqle ) {
log.warn( "Could not obtain connection metadata", sqle ); <-- Exception of getDatabaseMajorVersion will end here.
}
finally {
connections.closeConnection( conn );
}
}
catch ( SQLException sqle ) {
log.warn( "Could not obtain connection to query metadata", sqle );
dialect = DialectFactory.buildDialect( props );
}
catch ( UnsupportedOperationException uoe ) {
// user supplied JDBC connections
dialect = DialectFactory.buildDialect( props );
}
}
// dialect == null
// #169
properties.putAll( dialect.getDefaultProperties() ); <-- NullpointerException
My "dirty hack" to overcome this problem is to use the in-line documented code snippet @ line#111.
Is this a known issue? haven't found it in jira.