-->
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.  [ 4 posts ] 
Author Message
 Post subject: Cache is holding the old copy of the POJO
PostPosted: Fri Oct 28, 2005 6:35 am 
Newbie

Joined: Fri Aug 12, 2005 7:05 am
Posts: 8
I am encountering a problem where my updated record will be reverted back to previous copy of the record. Following is the senario:

1. I added about 10 records and the field "requestDate" in the 10 records has set to "null".
2. Recall any of the 10 records and set the "requestDate" to the current system date.
3. Verify in SQL 2000 database and the record updated correctly.
4. Recall another record out of the 10 without updating anything, I noticed the "requestDate" field in the record updated in Step 2 has been reverted back to "null". In fact all fields in that record has been reverted back as new inserted and not what I have updated in Step 2.

I realised from the JBoss log file that the Persistant Manager is trying to flush the old data of that record back to the database. Could this be a configuration problem in hibernate-service.xml as the following:

<attribute name="DatasourceName">java:jdbc/primdb</attribute>
<attribute name="SessionFactoryName">java:/hibernate/SessionFactory</attribute>
<attribute name="Dialect">org.hibernate.dialect.SQLServerDialect</attribute>
<attribute name="CacheProviderClass">org.hibernate.cache.HashtableCacheProvider</attribute>
<attribute name="Hbm2ddlAuto">update</attribute>
<attribute name="ShowSqlEnabled">true</attribute>
<attribute name="ReflectionOptimizationEnabled">false</attribute>
<attribute name="MaxFetchDepth">5</attribute>

Anyone can advise?

Thanks in advance


Top
 Profile  
 
 Post subject: LockMode.READ not forcing POJO refresh
PostPosted: Fri Oct 28, 2005 12:31 pm 
Beginner
Beginner

Joined: Fri Oct 28, 2005 12:26 pm
Posts: 21
I'm having the same problem (I think). I have this code

Code:
TrackingStep rootTracking = (TrackingStep)session.load(
    TrackingStep.class, rootTrackingID, LockMode.READ);


When I run the application, it generates this in the logs.

Code:
Locking entity: [com.idex.processtracking.bean.TrackingStep#21]
about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
select id from TrackingSteps where id =?
preparing statement
binding '21' to parameter: 1
about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
closing statement
resolved object in session cache: [com.idex.processtracking.bean.TrackingStep#21]


It seems that, for some reason, it's refreshing the ID, but gets the rest of the object from session cache. Does anyone know why this is happening?

Thanks,
Connor


Top
 Profile  
 
 Post subject: Woops
PostPosted: Fri Oct 28, 2005 12:34 pm 
Beginner
Beginner

Joined: Fri Oct 28, 2005 12:26 pm
Posts: 21
Missed two lines in the logs. Just in case you thought I wasn't using a read lock.

Code:
attempting to resolve: [com.idex.processtracking.bean.TrackingStep#21]
locking [com.idex.processtracking.bean.TrackingStep#21] in mode: READ
Locking entity: [com.idex.processtracking.bean.TrackingStep#21]
about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
select id from TrackingSteps where id =?
preparing statement
binding '21' to parameter: 1
about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
closing statement
resolved object in session cache: [com.idex.processtracking.bean.TrackingStep#21]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 15, 2005 2:54 am 
Newbie

Joined: Fri Aug 12, 2005 7:05 am
Posts: 8
My problem has solved. It is due to a session object being opened in the Web tier not closed after using.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.