Accessing inter-schema tables and relations in hibernate

Posted by nitesh on Stack Overflow See other posts from Stack Overflow or by nitesh
Published on 2010-06-11T16:22:44Z Indexed on 2010/06/11 19:53 UTC
Read the original article Hit count: 198

Filed under:
|
|
|

There is a typical situation being faced where different tables are scattered through different schemas in Oracle database and they are related to each other (encompassing all different types of relations).

How can they be represented in Hibernate using annotations as when a sessionfactory handle is created for one schema, tables in that schema can't access other related tables (foreign key relation to tables in other schema)?

For a query like following, exception is thrown -

"from table1 as model where model.table2Name.table2column = "+foo

Exception comes as -

org.hibernate.QueryException: 
    could not resolve property: 
    table2column of: 
    com.test.table1 
    [from com.test.table1 as model where model.table2Name.table2column = 1]

Here table1 and table2 are present in different schemas.

© Stack Overflow or respective owner

Related posts about java

Related posts about Oracle