This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

dependent entity beans - calling another entity bean's remove method  RSS feed

John Oo
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help! I've got a 2 tables where one table (A) has a foreign key to another table(B). When I'm doing a remove, I have to remove the entry in table (A) before I can remove the entry in table (B). So, in the entity bean for table B's ejbRemove() method I'm trying to call the remove method of table A's entity bean. However, I'm stuck inside a loop inside the ejbRemove() method of table B's entity bean. It gets stuck when I try to get the home interface. Should I be even be doing this in the ejbRemove() method? Is that what this method is for? Here's what I have
public void ejbRemove() throws RemoteException, EJBException
Debug.println("extended description is not empty");
RequisitionDescriptionPK pk = new RequisitionDescriptionPK(primary_key);
RequisitionDescriptionHome home = (RequisitionDescriptionHome)EJBFactory.getHome(RequisitionDescriptionHome.class);
Debug.println("got home interface");
RequisitionDescription reqDescription = home.findByPrimaryKey(pk);
Debug.println("Got remote interface");
Debug.println("removed extended description");
Any help or suggestions you can give me would be appreciated. Thanks.
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a section in the Developer's Guide that is helpful. There are a few ways to do one-to-many relationships with entity beans.

It is helpful to download the code and examine the full code of the beans they talk about... they only provide snips of them in the document.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!