While upgrading from hibernate 3 to hibernate 5, i am finding issues related to customization we were doing.
We have one entity mapped to more than one schemas like same table name in more than one schema which are managed by 2 different applications.
The below method is deprecated in hibernate 4 i think.
protected void postProcessConfiguration(Configuration config) {
super.postProcessConfiguration(config);
if (!DatabasePlatform.SAMPLE_SCHEMA.equals(DatabasePlatform.DEFAULT_SAMPLE_SCHEMA)) {
logger.info("Overriding SAMPLE schema name to %s", DatabasePlatform.SAMPLE_SCHEMA);
Iterator<PersistentClass> classIterator = config.getClassMappings();
while (classIterator.hasNext()) {
PersistentClass persistentClass = classIterator.next();
replaceSchemaName(persistentClass.getTable());
Iterator<Join> joinIterator = persistentClass.getJoinIterator();
while (joinIterator.hasNext()) {
replaceSchemaName(joinIterator.next().getTable());
}
Iterator<org.hibernate.mapping.Collection> collectionIterator = config.getCollectionMappings();
while (collectionIterator.hasNext()) {
replaceSchemaName(collectionIterator.next().getCollectionTable());
}
}
}
}
sfb.buildMappings(); is deprecated in 5.
Now i am using hibernate 5.1.15, how can i handle it ?
Where should i accommodate it ? should i override method and do it here ?
@Override
protected SessionFactory buildSessionFactory(LocalSessionFactoryBuilder sfb) {
}