Hi,
I have a sessionbean (stateless), that provides a method to create some entitys. If the creation of one Entity fails, I want do rollback all creations, there should be one or all entitys in the DB. I tried to set transaction type="required" on the method and I throw EJB Exceptions if something goes wrong, but after the method fails, there are still some entitys left.
Is there a way to tell JBoss to delete all entitys created in the method if the creation of one fails ?
The method looks like this (not actual code :-)
createXXX(){
try this:
try {
entityHome.create(1); entityHome.create(2); entityHome.create(3); return;
catch (CreateException ce) { logger.fatal("createXXX() failed", ce); sessionContext.setRollbackOnly(); throw ce; }
Rafal
}
If create(3) failes, I dont want to have 1 and 2 in my database.
Thanks a lot in advance,
Stefan
------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user