title: JPA Entiy on synonym instead of table
body: <p>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.</p>
  
  <p>Now, we had the request by operations department to split the data model into one schema being the owner of all database objects (<code>myschema</code>) and one schema acting as the application's database user (<code>myschema_app</code>). So I did the following:</p>
  
  <ul>
  <li>create schema <code>myschema_app</code></li>
  <li>grant object rights on all necessary tables from <code>myschema</code> (both regular ones and n:m intermediate tables) and sequences depending on the usage (one or more of <code>select</code>, <code>insert</code>, <code>update</code>, <code>delete</code>) to <code>myschema_app</code></li>
  <li>declare private synonyms in <code>myschema_app</code> in order to use the same names than before and hiding the other schema's name prefix</li>
  <li>change property <code>hibernate.default_schema</code> to new schema name in <code>persistence.xml</code></li>
  <li>change user/password in Tomcat's datasource definition in <code>context.xml</code></li>
  </ul>
  
  <p>When I start the application while having <code>hibernate.hbm2ddl.auto</code>set to <code>validate</code>, I get an exception when the framework tries to create the <code>EntityManagerFactory</code> telling me that a table is missing. When I execute a select statement directly in an sql tool with <code>myschema_app</code> connected, everything works fine.</p>
  
  <p>I understood that using a synonym going on another table is transparent for the application. Has anyone an idea what I may have overlooked?</p>