[JBoss AOP] - Interceptor invoked in context of Servlet but not JSP
by alen_ribic
I have an Interceptor that intercepts the Hibernate's LazyInitializationException. I also have Load Time Weaving turned on. This interceptor works well when called from within the context of the Web Application Servlet. (By well I mean the LazyInitializationException does get thrown and my Interceptor handles it.)
However, from Servlet to JSP context, my interceptor does not get invoked.
My JSP file has a simple call like this to an detached entity:
<td>${actionBean.user.department.users}</td>
The .users part throws the LazyInitializationException and should have been cough by my interceptor. The interceptor debug log doesn't run at all so I know the interceptor is not being called.
Same example with detached entity but in my Servlet that actually works:
| User user = getUserServiceRemote().getUser(getUserId());
| log.debug("Users: " + user.getDepartment().getUsers());
|
In the above, the .getUsers() part throws the LazyInitializationException and does get cough and handled by my interceptor.
Why does the JSP version not get intercepted?
Only thing I can think of is that the JSP version actually calls the Department.users attribute directly and not the getter. My pointcut is set on the getters only and not fields(attributes).
Thanks in advance.
-Al
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4231565#4231565
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4231565
16 years, 11 months
[EJB 3.0] - Re: failed to lazily initialize a collection of role:
by negora
bcowdery: First of all excuse my delay to answer you, but I thought that I had already done it. I'm sorry for that ;) .
Your explanation is very interesting to me. I'm using Stateless Session Beans in a very "little" environment (compared to a clustered one) so many of the concepts which you mentioned still are a little unfamiliar to me (I'm a rookie yet :P ). However, I'm gonna save a copy of this message for future reference. I'm sure that it will be really useful.
The first part of the explanation has solved all my doubts. Basically I'll try to avoid to use that kind of "lazy" operations out of the method which I use to retrieve the desired entity. Indeed I'm already applying that methodology and it's working very well :) .
Again, thank you very much for spending your time in helping me ;) .
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4231555#4231555
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4231555
16 years, 11 months