Skip to content
Advertisement

How to get exception inside ActionInvocation.invoke()

First of all the final purpose is that i’m trying to inject a DAO connection into an SMD context (Ajax) so i’ll ensure that transactions are being Commited (or Rollback), my problem is that i’m not being able to know if the invoke() method throws an exception,

I have the following Interceptor:

JavaScript

The line “attempt to solve” is based on this question. Inside the invoke i’m just throwing a NullPointerException, the result right now is that the exception is being catch before the catch at the Interceptor, however is not a catch that i had set,

JavaScript

I want ActionInvocation.invoke() to throw the exception so i’ll know i need to rollback the DB session. Any approach who succeed this purpose is welcome,

Edit 1: I’ve found this question that does almost the same as me but i dont understand how is using rollback (at my point of view is always doing rollback)

Greetings

Advertisement

Answer

I didn’t found any way to achieve my goal as i wanted, instead i’ve solved the scenario by doing this:

JavaScript

Yes… i removed “commit” instruction at interceptor, instead now im forced to do “commit” at the end of any call that uses the mentioned DAO,

JavaScript

I dont like this solution but it was all i was able to do. I came out with this like 1 day after posted the question, i waited for an answer until now,

Hope it helps someone,

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement