I'm using postgresql with a spring/hibernate to create a multi-tenant application where every company will have its own seperate schema and tables in the database.
So when the super administrator tries to add a new company, a new schema is supposed to be added to the database as well as the new tables generated from the hibernate entities (only the entities where the schema is set to dynamic).
@Table(name = "vehicule", schema="dynamic")
The problem is that I can't figure out how to generate the database tables from the entities using a hibernate query.
I know tha it's possible to do that using :
<property name="hbm2ddl.auto" value="create"/>
But it only will work when the sessionFactory is created and not on demand.
Any help will be appreciated..