After changing database schema in wildfly app server, hibernate retrieves existed tables from older datasource but new tables are created in my new datasource.
I debbuged some hibernate source codes. Noticed in org.hibernate.tool.hbm2ddl.TableMetadata class constructor parameters shows not consistent behaviour.
TableMetadata(ResultSet rs, DatabaseMetaData meta, boolean extras) throws SQLException {
this.catalog = rs.getString("TABLE_CAT");
this.schema = rs.getString("TABLE_SCHEM");
this.name = rs.getString("TABLE_NAME");
this.initColumns(meta);
if(extras) {
this.initForeignKeys(meta);
this.initIndexes(meta);
}
String cat = this.catalog == null?"":this.catalog + '.';
String schem = this.schema == null?"":this.schema + '.';
LOG.tableFound(cat + schem + this.name);
LOG.columns(this.columns.keySet());
if(extras) {
LOG.foreignKeys(this.foreignKeys.keySet());
LOG.indexes(this.indexes.keySet());
}
}
why rs.getString("TABLE_SCHEM") and meta.getConnection.getSchema() are giving different table schemas.
and how hibernate can access my older schema without username and password infos?
how could it be possible ?