Hi Aleksei,
In fact, i've just started to have the OpenSessionInFilterView to work.
But now, i've to face different kind of problems.
I can retrieve data from Hibernate using lazy initialisation ie i load
a collection objects, select one, view it (simple master-details view
city-zipcode relation) all tasks in a myfaces webapp.
but when i update one detail and want to save the master i have
a NonUniqueException that is raised.
I've read in the myfaces wiki that you have to reattach all objects to
the session at the beginning of the request. Is it the solution to my
problem (An instance which is loaded in different sessions) ?
How do you do it programmatically ? Do you have a registry of all
hibernate objects used in your application and reattach automatically
all objects at the beginnng of the request ?
Thanks
Sébastien
Hi.
> I'm trying to get Spring's OpenSessionInFilterView to work but i'm not
> very lucky.
We've got OSIV working in our JSF/MyFaces/Facelets/Spring app.
> I do :
>
> 1. Put in my web.xml :
[skip]
Looks fine.
> 2. My Application Context :
[...] looks fine.
> 3. I Have a static class use to retrieve the hibernate's session but
> it's not in the application context :
>
> I 've tried various methods :
>
> ApplicationContext ctx =
> FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance());
> sessionFactory = (SessionFactory) ctx.getBean("sessionFactory");
> return sessionFactory.getCurrentSession();
>
> return SessionFactoryUtils.getSession(getSessionFactory(),true);
>
> But nothing is working ...
I'd suggest using Hibernate through Spring's HibernateDaoSupport, not
accessing session factory/sessions directly.
Your setup looks fine. What exactly isn't working? Have you tried
downtracing? Is the session set in a thread-local var in your filter? Do
session factory/utils access this var?
Bye.
/lexi