-->
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.  [ 4 posts ] 
Author Message
 Post subject: Mapping a single object to multiple schemas
PostPosted: Thu Jun 22, 2006 5:57 pm 
Newbie

Joined: Tue Jun 07, 2005 10:46 am
Posts: 15
I didn't see this topic covered in the documentation so I don't think its possible, but I thought I would ask anyway before telling my customer its not possible.

Is it possible to construct hbm files sucha that you can map an Object, Car for instance, to two different schemas with two different CAR tables so that when a user queries for Car he gets back a collection of Car objects populated from both schemas.

That's all I need to know.

THanks,

Mike

_________________
M Connolly


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 22, 2006 6:55 pm 
Senior
Senior

Joined: Sun Jun 04, 2006 1:58 am
Posts: 136
Is this what you are looking for
Quote:
http://www.hibernate.org/hib_docs/v3/reference/en/html/mapping.html#mapping-entityname


if you want to construct the query from two table what would be the id . I dont understand . Or is that each subtype of car is mapped to a different table in which case you can use joined-subclass type of mapping

_________________
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 22, 2006 8:54 pm 
Newbie

Joined: Tue Jun 07, 2005 10:46 am
Posts: 15
I saw that documentation, but that seemed to be a situation where my two tables would be in the same database. If I had two database servers with two schemas and each had a CAR table and for arguement sake had the exact same structure would I be able to query for "car model" and hibernate would be able to connect to two different datbases and bring back records from both tables to populate my objects. This is a weird use case, but my customer wants me to build a drag and drop hibernate mapping tool that will allow him to map an object in one object model to more than one datasource. I don't think this is possible but I'm not sure.

Thanks,

Mike

_________________
M Connolly


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 22, 2006 11:56 pm 
Beginner
Beginner

Joined: Mon Jul 26, 2004 4:29 pm
Posts: 45
Location: TX, USA
It's not a Hibernate solution, but perhaps you could use Spring's HibernateTemplate. You could have a different HibernateTemplate for each database and include the mapping file in the config for each template.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.