Hibernate Schema Validation Fails on Oracle Table Synonyms

Posted by Rob on Stack Overflow See other posts from Stack Overflow or by Rob
Published on 2010-06-11T13:13:11Z Indexed on 2010/06/14 1:02 UTC
Read the original article Hit count: 690

Filed under:
|
|
|
|

I'm developing a Java web application that uses Hibernate (annotations-based) for persisting entities to an Oracle 11g database. The DBA created synonyms for the tables and requested that I use these synonyms instead of the physical tables. (Eg: Table "Foo" has synonym "S_Foo")

If I have "hibernate.hbm2ddl.auto=validate" enabled, then the application fails on startup with "Missing Table: S_Foo". If I turn off the validation, then the app starts up fine and works properly. My guess is that Hibernate only checks against physical tables and not synonyms when validating that a table exists.

Is there any way to enable Hibernate schema validation with synonyms? Can I specify both a physical table and a synonym in the annotation? I prefer having that extra safety check that the table structure is correct when the application starts up.

© Stack Overflow or respective owner

Related posts about java

Related posts about Oracle