I finally got the custom OpenSessionInViewFilter to work and I could
make sure getSession() and closeSession() are called.
When debugging my app to figure out why my call to the backing bean is
cached I've seen that the class Cglib2AopProxy is involved.
So I guess my transaction handling is wrong.
I use <tx:advice ..>, <aop:config> for my service beans and tried to
apply this config also to my dao beans. (don't know if this is
necessary) but still the same problem.
I also have this
    <bean id="transactionManager"
        class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory" />
        <property name="dataSource" ref="dataSource" />
    </bean>
in my config.
I may be on the wrong path.. can someone give me a hint in the right direction?

thanks
Bastian




2010/2/18 "Günther, Rene - Innflow AG" <rene.guent...@innflow.com>

> Sorry, I am always using OpenSessionInViewFilter but I dont know that error
> and I never used Trinidad.
>
> Cheers
> Rene
>
> -----Ursprüngliche Nachricht-----
> Von: baeschtu baeschtu [mailto:baesc...@gmail.com]
> Gesendet: Mittwoch, 17. Februar 2010 21:21
> An: MyFaces Discussion
> Betreff: Re: [Trinidad] Backing Bean Caching issue
>
> >> Also what session pattern do you use?
> >>
> http://wiki.apache.org/myfaces/Hibernate_And_MyFaces<
> http://wiki.apache.org/
> myfaces/Hibernate_And_MyFaces>
> Yes, this may be the missing part!
> I tried "One Session per Request via Servlet Filters" but when it comes to
> extend the OpenSessionInViewFilter I got a
> "The hierarchy of the type OpenSessionInViewFilter is inconsistent"
> Which session pattern do you recommand for myfaces trinidad 1.2.5 with
> spring 2.5.6.SEC01 and hibernate 3.3.2.GA.
>
> thanks
> Bastian
>
>
> PS: I checked that the entity is written to mysql.
>
>
> 2010/2/17 "Günther, Rene - Innflow AG" <rene.guent...@innflow.com>
>
> > Like Jakob asked already: Are you sure your entity is saved in your
> > database?
> > After adding the object from your "add object" - page can you look into
> the
> > table directly. Eg. if you use MySQL you could check in the MySQL query
> > browser.
> >
> > Also what session pattern do you use?
> > http://wiki.apache.org/myfaces/Hibernate_And_MyFaces
> >
> > Cheers
> > Rene
> >
> > -----Ursprüngliche Nachricht-----
> > Von: baeschtu baeschtu [mailto:baesc...@gmail.com]
> > Gesendet: Mittwoch, 17. Februar 2010 11:43
> > An: MyFaces Discussion
> > Betreff: Re: [Trinidad] Backing Bean Caching issue
> >
> > I tried query.setCacheable(false); in my dao but no change.
> > But also when I try to add the second record, I get a:
> > org.hibernate.NonUniqueObjectException: a different object with the same
> > identifier value was already associated with the session:
> > What confuses me, It works with an other entity which is implemented the
> > same way.
> >
> >
> >
> > 2010/2/17 Jakob Korherr <jakob.korh...@gmail.com>
> >
> > > Hi,
> > >
> > > It seems to me like a hibernate problem. Are you sure your entitiy is
> > saved
> > > in your database? Are you refreshing the entities from the database
> each
> > > time you call getEntities()?
> > >
> > > Regards,
> > > Jakob
> > >
> > > 2010/2/17 baeschtu baeschtu <baesc...@gmail.com>
> > >
> > > > I have two myfaces pages with a backing bean each.
> > > > Both of them have a spring service injected to get access to the
> > > hibernate
> > > > dao's.
> > > > They are related 1-N
> > > >
> > > > So I have a <f:selectItems> combobox in one of them served by a
> method
> > > like
> > > > this in the backinbean.
> > > >
> > > >    private List<Entity> entities;
> > > >    ..
> > > >    public UISelectItems getEntityList() {
> > > >        entityList = new UISelectItems();
> > > >        entities = getEntities();
> > > >        Object[] values = new Object[entities.size()];
> > > >        int count = 0;
> > > >        for (Entity e : entities) {
> > > >            values[count] = new SelectItem(e.getId(), e.getName());
> > > >            count++;
> > > >        }
> > > >        entityList.setValue(values);
> > > >        return entityList;
> > > >    }
> > > >
> > > >
> > > > So the problem is, when I add an Entity on the other page and return
> to
> > > the
> > > > page with the combobox. The newly added Entity does not show up in
> the
> > > > combobox. So I assume I get a cached version from the backing bean or
> > the
> > > > items are still cached in the viewState.
> > > >
> > > > thanks
> > > > Bastian
> > > >
> > >
> >
> >
>
>

Reply via email to