myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From baeschtu baeschtu <baesc...@gmail.com>
Subject Re: [Trinidad] Backing Bean Caching issue
Date Mon, 22 Feb 2010 15:20:59 GMT
thanks a lot Rene, my backing bean was not in request scope, shame on me.
:-)


2010/2/21 Günther, Rene - Innflow AG <rene.guenther@innflow.com>

> I dont know much about that, but your config looks uncommon to me. In our
> current project we got
>
>
>
> <bean id="transactionManager"
> class="org.springframework.orm.hibernate3.HibernateTransactionManager">
>        <property name="sessionFactory" ref="sessionFactory"/>
>    </bean>
>
> +
>
> <bean id="sessionFactory"
> class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
>
>        <property name="dataSource" ref="dataSource"/>
>        <property name="configLocation"
> value="classpath:hibernate.cfg.xml"/>
>        <property name="hibernateProperties">
>            <value>
>                hibernate.dialect=${hibernate.dialect}
>                hibernate.query.substitutions=true 'Y', false 'N'
>                hibernate.cache.use_second_level_cache=true
>
>  hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
>            </value>
>            <!-- Turn batching off for better error messages under
> PostgreSQL -->
>            <!-- hibernate.jdbc.batch_size=0 -->
>        </property>
>    </bean>
>
>
> But maybe that doesn’t help you at all :)
>
>
> Cheers
> Rene
>
> -----Ursprüngliche Nachricht-----
> Von: baeschtu baeschtu [mailto:baeschtu@gmail.com]
> Gesendet: Sonntag, 21. Februar 2010 17:21
>
> An: MyFaces Discussion
> Betreff: Re: [Trinidad] Backing Bean Caching issue
>
> 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.guenther@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:baeschtu@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.guenther@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:baeschtu@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.korherr@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 <baeschtu@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
>> > > >
>> > >
>> >
>> >
>>
>>
>>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message