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
Add the following code to the DynamicSchemaHibernateConfiguration.java class to incorporate it:
dynamicIdentifierGeneratorFactory = new DynamicIdentifierGeneratorFactory(this);
This will only work with Hibernate 3.5 or newer (which adds schema support to sequences).
public DefaultIdentifierGeneratorFactory getIdentifierGeneratorFactory()