tag:blogger.com,1999:blog-7312326189952469195.post8932156204674030738..comments2016-08-18T08:22:01.621+02:00Comments on Pal's blog about programming and stuff: Exceptions and Transactions in EJB, dealing with EJBException and EJBTransactionRolledbackExceptionpalkonyveshttp://www.blogger.com/profile/11665599490066388736noreply@blogger.comBlogger18125tag:blogger.com,1999:blog-7312326189952469195.post-23578190628513565522016-05-20T02:53:53.919+02:002016-05-20T02:53:53.919+02:00one thing is missing. if myEjbMethod is part of a ...one thing is missing. if myEjbMethod is part of a local interface called by a web-application in the same ejb-container and myOtherEjbMethod runs with a remote-interface, then the EjbException will be thrown, not the EjbTransactionRolledBackException.<br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7312326189952469195.post-73039123318480989162015-09-23T16:04:21.140+02:002015-09-23T16:04:21.140+02:00Perfect explanation, thank you very much! Perfect explanation, thank you very much! Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7312326189952469195.post-70322237307386769182014-09-10T13:47:19.120+02:002014-09-10T13:47:19.120+02:00+1 Vote for this post.
Informative, practical and...+1 Vote for this post.<br /><br />Informative, practical and concise. At the end of the day, that's what matters.<br /><br />Thank you.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7312326189952469195.post-65125750135410126802014-09-03T12:07:19.004+02:002014-09-03T12:07:19.004+02:00Thank you. I have spend a lot of hours to find how...Thank you. I have spend a lot of hours to find how to work with EJB. Your article in conjunction with another one (http://entjavastuff.blogspot.ru/2011/02/ejb-transaction-management-going-deeper.html) makes my project work perfectly.Anonymoushttps://www.blogger.com/profile/07210644801589426081noreply@blogger.comtag:blogger.com,1999:blog-7312326189952469195.post-42566348809118810492014-06-21T08:30:10.269+02:002014-06-21T08:30:10.269+02:00What will happen when both the methods runs in the...What will happen when both the methods runs in the same transaction, but the myEjbMethod() method catches the exception and trying to do something else. Still that transaction will be rolled back? Anyway to handle this?<br /><br />....<br />public vod myEjbMethod() {<br /> try {<br /> myOtherEjbMethod();<br /> } catch (SomeApplicationException e) {<br /> myYetOtherEJBMethd();<br /> }<br />}<br />......<br /><br />@ApplicationException(rollback=true)<br />public class SomeApplicationException extends Exception {<br />..<br />}<br /><br />Srihttps://www.blogger.com/profile/10949019871934826262noreply@blogger.comtag:blogger.com,1999:blog-7312326189952469195.post-10241313775529535032014-05-09T16:24:05.772+02:002014-05-09T16:24:05.772+02:00Great explanations. Thanks!Great explanations. Thanks!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7312326189952469195.post-46972516075457755352014-03-18T09:14:27.402+01:002014-03-18T09:14:27.402+01:00thank you very much, it's really excellent pos...thank you very much, it's really excellent post!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7312326189952469195.post-8073212141299977162014-01-21T14:52:52.839+01:002014-01-21T14:52:52.839+01:00You could handling the Application Exception using...You could handling the Application Exception using the @ApplicationException too. With this annotation, you could to define if the Application Exception must be rolled back or not, in this way:<br /><br />@AnnotationException(rollback="true")<br />public class MyAppException extends Exception{ //some code here}<br /><br />If the MyAppException is thrown, then the transation will be rolled back. If the rollback parameter is set to "False", then the transaction won't be rolledback. In this way you don't have to extend from RuntimeException for a application exception. I think it's better in this way and more elegant.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7312326189952469195.post-81237945384887974692013-12-18T05:28:22.847+01:002013-12-18T05:28:22.847+01:00Excellent post! Congratulations. Thanks man!Excellent post! Congratulations. Thanks man!Anonymoushttps://www.blogger.com/profile/13535077415613652922noreply@blogger.comtag:blogger.com,1999:blog-7312326189952469195.post-85452772802265955182013-11-26T07:08:39.909+01:002013-11-26T07:08:39.909+01:00Really a very nice article. Thanks Pal :-).Really a very nice article. Thanks Pal :-).Prabu Selvarajanhttps://www.blogger.com/profile/02465035745057942982noreply@blogger.comtag:blogger.com,1999:blog-7312326189952469195.post-51872155012851926472013-11-20T14:54:15.683+01:002013-11-20T14:54:15.683+01:00Really enjoyed reading your post. Very clear expla...Really enjoyed reading your post. Very clear explanation of this topic. Thank youAnonymoushttps://www.blogger.com/profile/03696784195733394337noreply@blogger.comtag:blogger.com,1999:blog-7312326189952469195.post-31027204033258681732013-10-01T12:48:02.583+02:002013-10-01T12:48:02.583+02:00Excellent post. Thank you very much.Excellent post. Thank you very much.YILDIRAY YILMAZnoreply@blogger.comtag:blogger.com,1999:blog-7312326189952469195.post-31812347845698482992013-08-22T20:09:42.411+02:002013-08-22T20:09:42.411+02:00Hi,
I haven't tried Seam Catch, so I cannot m...Hi,<br /><br />I haven't tried Seam Catch, so I cannot make any comments about it. I think you cannot affect with interceptors the way how the container handles exceptions.palkonyveshttps://www.blogger.com/profile/11665599490066388736noreply@blogger.comtag:blogger.com,1999:blog-7312326189952469195.post-77235940433913007782013-08-22T20:06:17.528+02:002013-08-22T20:06:17.528+02:00Hi, I see your point. It is ambiguous to me that &...Hi, I see your point. It is ambiguous to me that 'may or may not be marked for rollback' is whether up to the container or up to the client code.<br /><br />It would be interesting if they made this decision up to the implementation, as this sentence does not say anything else about the condition.<br /><br />What is your opinion?palkonyveshttps://www.blogger.com/profile/11665599490066388736noreply@blogger.comtag:blogger.com,1999:blog-7312326189952469195.post-90138542529276168362013-08-21T15:33:46.671+02:002013-08-21T15:33:46.671+02:00It would be interesting to get your opinion on Sea...It would be interesting to get your opinion on Seam Catch framework and how it fits into this model.<br /><br />Cheers,<br />Andy Z.Unknownhttps://www.blogger.com/profile/08570759254672868961noreply@blogger.comtag:blogger.com,1999:blog-7312326189952469195.post-60362161077979919182013-08-21T11:43:53.984+02:002013-08-21T11:43:53.984+02:00"When myOtherEjbMethod() uses a new transacti..."When myOtherEjbMethod() uses a new transaction (with RequiresNew transactional attribute), in case of a RuntimeException, the container will wrap it in a EJBException. You will know, that it caused the new transaction to roll back, but you can continue the outer transaction" <br /><br />The EJB spec says that in this case the transaction may or may not be rolled back.<br /><br />Please review EJB Spec, page 386, table 15. and section 14.4.2.Anonymoushttps://www.blogger.com/profile/01041963155581349700noreply@blogger.comtag:blogger.com,1999:blog-7312326189952469195.post-59082824643628756592013-08-16T21:23:19.228+02:002013-08-16T21:23:19.228+02:00Thank you, I was wondering how understandable this...Thank you, I was wondering how understandable this post is. For me it did not turn out to be so clear and linear. But I am glad, you found it useful.palkonyveshttps://www.blogger.com/profile/11665599490066388736noreply@blogger.comtag:blogger.com,1999:blog-7312326189952469195.post-90760948171335099442013-08-14T10:50:33.715+02:002013-08-14T10:50:33.715+02:00Nice explanation. Really loved your write up.Nice explanation. Really loved your write up.Anonymousnoreply@blogger.com