I have a Seam 2.2 based Java EE 5 web application with a bunch of tables mapped to JPA 1.0 Entities via Hibernate 3.3.3. During development it's running on a Tomcat 6, Oracle 10 XE and Windows 7.
Now, we had the request by operations department to split the data model into one schema being the owner of all database objects (myschema
) and one schema acting as the application's database user (myschema_app
). So I did the following:
myschema_app
myschema
(both regular ones and n:m intermediate tables) and sequences depending on the usage (one or more of select
, insert
, update
, delete
) to myschema_app
myschema_app
in order to use the same names than before and hiding the other schema's name prefixhibernate.default_schema
to new schema name in persistence.xml
context.xml
When I start the application while having hibernate.hbm2ddl.auto
set to validate
, I get an exception when the framework tries to create the EntityManagerFactory
telling me that a table is missing. When I execute a select statement directly in an sql tool with myschema_app
connected, everything works fine.
I understood that using a synonym going on another table is transparent for the application. Has anyone an idea what I may have overlooked?
My guess is that hbm2ddl seaches specifically for tables, and not for synonyms, but that your application should indeed work as if the tables existed in the schema. Try to remove the hbm2ddl option and test your application.
EDIT: it seems my guess is true: https://forum.hibernate.org/viewtopic.php?p=2438033