Hi everybody,
I have two tables in two separate oracle databases (not schemas) that I need to join in Hibernate. Currently, I have two hibernate sessions going out to the separate databases. Before anybody says look at Hibernate Shards, I have spent a better part of a day looking at that sub-project and have found that: it is for horizontal partitioned data (all the tables must be in all of the databases AFAIK), there is no way for one to tell shards to look only in one database (Hibernate Shards Docs), and is no longer being worked on.
Things that I have thought about to try to solve this problem:
Doing a
findAll()
or some restricted variant of that on both of the tables, and manually doing the join using some loops. (Ok for very small tables - prohibitive from small tables on up)Have the sessions do some kind of interaction (I have no idea if this is even feasible - will have to look at the Hibernate Session API)
Removing the database name from the url string of different hibernate-xxxx.cfg.xml and insert them into the separate hbm.xml files like this:
<class name="foo" table="foo_table" schema="foo_schema" catalog="foo_db">
(Doesn't seem to work from my initial tests and that seems like truck sized security hole)Use the Repository Pattern (Unsure if my Java-Fu is strong enough)
Is there something that I'm overlooking in one of the cases above or can it be another way that I haven't listed above?