You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Simon James <sj...@btisystems.com> on 2010/09/20 09:48:18 UTC

Multiple Schemas with Derby, Hibernate & JPA

I have a problem using multiple schemas with Derby, Hibernate & JPA.
Although I don't have the problem when using MySql, the database/schema models of Derby and MySql are different and so
I realise this might be a problem with Hibernate rather than Derby.

I have 2 schemas (S1 & S2) each of which contains a table of the same name (MyTable) which is created from the same Java entity.

When I create the EntityManagerFactory with the url for S1 (for example: jdbc:derby:dbname;create=true;user=S1), MyTable is created in schema S1.
When I create the EntityManagerFactory with the url for S2, Hibernate logs a message indicating that MyTable already exists and so does not create it.
However, if I subsequently use an EntityManager created by the factory for S2, inserts fail because MyTable does not exist.

Has anybody else experienced this problem?

Regards

Simon