The one problem with this configuration is that it only handles tables, not sequences. I've attached an addition that will handle correcting sequences as well.
Add this line to the constructor of DynamicSchemaHibernateConfiguration.java
Code:
dynamicIdentifierGeneratorFactory = new DynamicIdentifierGeneratorFactory(this);
Add the following code to the DynamicSchemaHibernateConfiguration.java class to incorporate it:
Code:
public DefaultIdentifierGeneratorFactory getIdentifierGeneratorFactory()
{
return dynamicIdentifierGeneratorFactory;
}
This will only work with Hibernate 3.5 or newer (which adds schema support to sequences).