Search code examples
javaoracle-databasesynonym

Synonyms views and tables in oracle


Using jpql, I used:

  • createQuery with Tables.
  • createNativeQuery with Views.

Could you please tell me what I have to use with synonyms createQuery or createNativeQuery ?. I found a problem with data stored in synonyms (oracle) when running my spring-mvc project..

Big thanks.


Solution

  • The original support for synonyms for Oracle and other RDBMses was introduced at a point I can't determine exactly. I suppose even Hibernate 3 had some support for them with the hibernate.synonyms=true property.

    Still, there are a few synonym related bugs, such as hibernate.hbm2ddl.auto=validate not working before 4.2.1 and fixing that with hibernate.connection.includeSynonyms=true.

    Since the behaviour of validate and update are related (they both need to understand synonyms), I assume that the minimum version you need to upgrade to solve your problem would be 4.2.1.