• Post Reply Bookmark Topic Watch Topic
  • New Topic

cascade delete  RSS feed

 
Ec Kjellberg
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

I got some questions from other people why I don't use CASCADE DELETE directly in the database instead of using EJB cascade delete in the CMR.

I tried with less success to talk about that we could throw an exception in the ejbRemove method (if we for some strange reason don't allow an EJB to be removed) and then the transaction will be rolled back. This control we could never have if we used database cascade delete.

And I guess that if we did a database cascade delete then the J2EE EJB cache could get in trouble (I�m using JBoss).

What do you all think and/or use?
 
niklas nobel
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just want to point out that it is NOT evident that the transaction will be rolled back if an exception is thown. A runtime exception will cause a rollback, an application exception like javax.ejb.RemoveException will NOT cause the container to rollback the tx. im wondering what happens to a cascade delete if one of the participating entities throw a RemoveException? Will that stop the tx leaving the database inconsistent? stop the tx and rollback (despite the nature of the exception)? proceed with the tx and raise the RemoveException at the end?

/2n
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!