-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Objects not updating in cache
PostPosted: Sat Aug 27, 2005 2:27 am 
Beginner
Beginner

Joined: Fri Jun 04, 2004 12:50 pm
Posts: 32
Hi all,

I have a second level cache which I am using with my hibernate sessions. I am getting my session factory from JNDI and creating a session each request as described in "Hibernate In Action".

I am having a problem though after I delete or update an object. The changes can be immediately seen in the database. But, the references to the objects in the cache are either not removed or not updated. If I then wait about 30 seconds and try again everything is updated.

What do I need to set or change so that changes are automatically reflected in the cache as well as the database?

Cheers
Tom

Hibernate version: JBoss 4.0.2 (I think its 2.1.7)

Config documents:
<server>
<mbean code="org.hibernate.jmx.HibernateService" name="jboss.jca:service=HibernateFactory,
name=HibernateFactory">
<depends>jboss.jca:service=RARDeployer</depends>
<!-- Make it deploy ONLY after DataSource had been started -->
<!-- <depends>jboss.jca:name=LocalTxCM,name=PostgresDS</depends> -->
<attribute name="MapResources">
com/camp/common/accounting/ApplicationAccounting.hbm.xml,
com/camp/common/action/Action.hbm.xml,
...</attribute>
<attribute name="JndiName">java:/CAMP/HibernateFactory</attribute>
<attribute name="Datasource">java:/PostgresDS</attribute>
<attribute name="Dialect">org.hibernate.dialect.PostgreSQLDialect</attribute>
<attribute name="ShowSqlEnabled">true</attribute>
<attribute name="SecondLevelCacheEnabled">true</attribute>
<attribute name="CacheProviderClass">org.hibernate.cache.EhCacheProvider</attribute>
<attribute name="QueryCacheEnabled">true</attribute>
</mbean>
</server>

Full stack trace of any exception that occurs:
This stack trace happens after I delete an object and then try to list a set of objects which used to include the deleted object. (If that makes any sense)

00:21:43,337 INFO [STDOUT] Hibernate: select menuitem0_.id_menu_item as id1_0_, menuitem0_.name as name65_0_, menuitem0
_.next_menu as next3_65_0_, menuitem0_.fk_id_menu as fk4_65_0_, menuitem0_.fk_id_role as fk5_65_0_ from tblMenuItem menu
item0_ where menuitem0_.id_menu_item=?
00:21:43,347 INFO [DefaultLoadEventListener] Error performing load command
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.camp.common.menu.MenuItem#1608]
at org.hibernate.ObjectNotFoundException.throwIfNull(ObjectNotFoundException.java:27)
at
Name and version of the database you are using:
Postgres 8.0


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 3:55 pm 
Beginner
Beginner

Joined: Fri Jun 04, 2004 12:50 pm
Posts: 32
Does anybody have any clue why this might be happening? I have been unable to solve it.

I do have another question though. If I begin a transaction and then begin another transaction inside the first, might this be causing any issues? I do close both transactions so I thought that everything would be correctly cached and saved etc.

Anybody?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 7:39 pm 
Newbie

Joined: Wed Jan 05, 2005 12:30 pm
Posts: 17
Location: Philadelphia, PA
Care to post your Mapping documents? Cache configuration?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.