jQuery in Action, 3rd edition
The moose likes EJB and other Java EE Technologies and the fly likes One-to-Many collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "One-to-Many collection" Watch "One-to-Many collection" New topic

One-to-Many collection

Faraz Ali
Ranch Hand

Joined: May 15, 2008
Posts: 108
Hi All,

I have implemented a ejb 3.0 one-to-many relationship. I want to remove one element from the collection, how i can do it.

For example,
City has one to many relationship with branches. And it maitains a branches collection. Now i want to remove one branch element from that collection. Whats the best way to do it?
Bill Shirley
Ranch Hand

Joined: Nov 08, 2007
Posts: 457
does city own branches? (i.e. is the branch being deleted by being removed from city?)

how do you have the attribute annotated? (show source, include all annotations)

you basically need to only remove the branch from the collection of branches and update the city,

Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);
Faraz Ali
Ranch Hand

Joined: May 15, 2008
Posts: 108
Yes, City owns Branches collection. And yes, i also think same, i only need to remove branch object from collection, and update the city, but sadly its not working.

For the code, you can refer to my previous post http://www.coderanch.com/t/321403/EJB-JEE/java/One-Many-bidirectional.

Also tell me the good way to do this.

I agree. Here's the link: http://aspose.com/file-tools
subject: One-to-Many collection
jQuery in Action, 3rd edition