-->
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: Hibernate Shards - Object contains object in other database
PostPosted: Fri Apr 13, 2007 8:52 am 
Newbie

Joined: Fri Apr 13, 2007 8:38 am
Posts: 4
Location: Germany, Dresden
Hi,

I'm new to Hibernate Shards. So I thougt I can use Hibernate Shards to solve the following problem.

In database A is a table called Invoice. It has InvoiceID and several other fields. It also has a field called customerID.
In this field customerID is the ID from the customer who belongs to the invoice. But the table customer is in database B. So you can imagine, that there is a foreign-key-relation. Of course there is not a real foreign-key-relation, because I think that it is not possible to do so about several databases.

Now I want to load and store the object invoice from database A table invoice, where it is necessary to load or store the customer belonging to the invoice in database B table customer.

Is this possible with Hibernate Shards???

If not, do you know a good object oriented way to solve this issue?

Thank you very much!!

Cheers,
Steffen


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 13, 2007 9:30 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Shards does not support cross-shard relationship, so you will have to break the object relationship. One way to do it is to only store customerId in your invoice object, and do a request (session.get(Customer.class, customerId)) to load it.

_________________
Emmanuel


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.