• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB relationships

 
Giju George
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have got a facade (OrderManager) which access/creates orders and orderitems using CMR. So the facade does the lookup and creates the OrderEJB, which then creates the OrderItemEJB from its ejbPostcreate().

And if I delete an order, all the orderitems will be deleted using cascade-delete. But what's the best way to delete an orderitem from the facade layer, given the orderitem id? Can the facade(OrderManager) find the particular orderitem using its id (ejbFindbyPK()) and then call ejbRemove(). Well that works but here it's calling orderitemEJB without going through the orderEJB, but is that the right way ???
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that's a perfectly valid approach.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!