-->
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.  [ 3 posts ] 
Author Message
 Post subject: Associations by key
PostPosted: Tue Sep 21, 2004 6:22 am 
Newbie

Joined: Mon Sep 20, 2004 6:58 am
Posts: 6
Hi,

I am currently using Hibernate for persistence in DAO objects. My question is : can Hibernate handle associations based on keys instead of a direct reference ?

What I mean is this : normally aProduct.getCustomer() returns an associated customer, but in some cases associations are maintained solely via key objects. In that case, aProduct.getCustomerKey() returns the key object of type CustomerKey that holds the unique ID to a certain customer, and aProduct.setCustomerKey(aCustomerKey) sets it - there are no other getters and setters for customer on a product object.

Sofar I have experimented with <idbag>, components as composite IDs, and PropertyAccessors but I didnt get it to work. Can it be done ? Can you show me how ?

Kind regards,

sytze.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 21, 2004 6:24 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Well, just map it as a normal property I'd say ...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 21, 2004 6:40 am 
Newbie

Joined: Mon Sep 20, 2004 6:58 am
Posts: 6
But then I lose the cascading functions of Hibernate, right ? I.e. I have to update both ends of the association individually on a bi-directional assoication-by-key.


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