2007/5/23, Célio Cidral Junior <[EMAIL PROTECTED]>:
Hi,

I want to implement an OpenInView pattern interceptor involving
Hibernate, but there's a problem. My SessionFactory is both created
and managed by Spring, and my interceptor should have access to that
SessionFactory, however I don't know how to do that. I have already
searched a lot the web and the docs but couldn't find an answer. Does
anybody know if that's possible (and how)?.

if your SessionFactory is injected in your action, and all your
actions extend "AbstractAction" for example, that has a
getSessionFactory() method, you can do this:

public String intercept(ActionInvocation invocation) throws Exception {
   Action action = (Action) invocation.getAction();
   if (action instanceof AbstractAction) {
       sessionFactory = ((AbstractAction) action).getSessionFactory();
...
}
--
Guillaume Carré

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to