Access to tables and relationships between schemes in sleep mode

There is a typical situation where different tables are scattered according to different schemes in the Oracle database and are related to each other (covering all different types of relations).

How can they be represented in Hibernate using annotations, as when creating a sessionfactory descriptor for one schema, tables in this schema cannot access other related tables (the ratio of foreign keys to tables in another schema)?

An exception was thrown for a query like the following -

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

The exception occurs 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 schemes.

+6
java oracle hibernate schema
source share
1 answer

Finally, I got a solution. This is done using the schema annotation for this table as follows: @ Entity @Table (name = "table1", schema = "schema1") Also, the mapping of class table2 should be included in the table 1 schema configuration file.

+2
source share

All Articles