I have two different persistence units in my application. I’m using JPA 2.0 with Hibernate as my entity provider. In one of my database schemas, I have a table which contains a column which has a foreign key relationship to a table in the other schema. These tables are mapped as separate entities in my code with no relationship. Is it possible to construct a named query to join across these two schemas?
Share
No, it’s not possible. You have a few options, not all of them will be useful for your case:
As a rule of thumb, if you have a FK between schemas, you have a problem with how the domain was divided, as the boundaries are not exaclty right.