-->
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: Managed Associations?
PostPosted: Mon May 22, 2006 1:12 am 
Newbie

Joined: Sat Dec 03, 2005 3:03 am
Posts: 5
Does JPA support managed associations like EJB 2.1 Entities or is scaffolding code still necessary? I cannot find anything explicit in the specification.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 22, 2006 5:27 am 
Newbie

Joined: Thu May 18, 2006 12:23 pm
Posts: 6
If I understood you right, no, it doesn't.
It means you should "synchronize" direct and inverse sides of bidirectional association in your code. Just direct side of association (annotated without "mappedBy") would be stored to database. But other aspects of managed relationships are supported: storing collection changes when element is removed, replaced or added, cascading of operations to dependant entities etc.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 22, 2006 10:36 am 
Newbie

Joined: Sat Dec 03, 2005 3:03 am
Posts: 5
Just to be clear... what you're saying is when adding a Bid into an Item, the following code is still required to manage the bidirectionality (where as EJB 2.1 would have updated the reference to item automatically)?

Code:
public void addBid(Bid bid) {
  bid.item = this;
  bids.add(bid); 
}


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 22, 2006 1:16 pm 
Newbie

Joined: Thu May 18, 2006 12:23 pm
Posts: 6
Yes, exactly.


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.