-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: selecting from multiple DB
PostPosted: Fri Nov 30, 2007 8:59 am 
Newbie

Joined: Thu Nov 29, 2007 4:59 am
Posts: 3
Location: Milano - Italy
Hi, you know if is it possible to make a query referencing multiple DB in HQL? That is: I have three legacy system, each one with its DB (one oracle, one sqlserver, one mysql ...don't tell...), I already have all them in one application using different hibernate configuration files.
I want to make a query like

select table_from_db_a
from Table_from_db_a table_from_db_a
where table_from_db_a.commonKey not in
(select table_from_db_b.comonKey
from Table_from_db_b table_from_db_B
)

Is it possible?
Thank you,
Marco


Top
 Profile  
 
 Post subject: multiple databases with Hibernate
PostPosted: Fri Nov 30, 2007 10:12 am 
Newbie

Joined: Fri Nov 16, 2007 10:42 am
Posts: 6
Hi,

I'm facing a similar scenario, just with two different PostgreSQL databases. In PostgreSQL there's a feature called dblink that lets you do remote queries. I know that Oracle has got a similar feature, not sure about the others. AFAIK Hibernate hasn't got any built-in support for multiple DBs. Try mapping classes with custom SQL queries using <sql-query>, <subselect>.
Another approach would be to query all databases separately and join manually in your application code. I think there's no good solution to this.

If anyone has got a different solution I'd like to know, since my current solution is not very efficient.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.