Accessing inter-schema tables and relations in hibernate
- by nitesh
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.