Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:2.1.1
Hi All,
I've been facing a problem of stale object being returned, i'll describe the scenario and problem.
Technologies & interaction is as follows:
SWT -> AXIS -> SPRING -> HIBERNATE
WEBSERVER: TOMCAT 4.1.3
documents are being processed by a desktop application developed using swt. only those documents with status 1 or 2 must be fetched for processing. After processing the status changes to 3. The problem is that sometimes (say 5 out of 1000 documents) duplicate documents are loaded. i have verified that database is being updated and from database perspective there is no chance of reloading a document.
As far as the transction is concerned, i am using spring's transaction template which has a block of code which needs to run in the same transaction context.
My requirement is that everytime a fresh document should be available for processing.
i was just going through hibernate reference, and came across the following para:
" Except when you explicity flush(), there are absolutely no guarantees about when the Session executes the JDBC calls, only the order in which they are executed. However, Hibernate does guarantee that the Query.list(..) will never return stale data; nor will they return the wrong data."
instead of using HibernateTemplate, if i replace with session.createQuery.... kinda stuff then will it help me?
i have also used clear and evict to ensure that i get rid of the objects.
i've been bogged up with this situation for some time now.
i know the culprit is me :) there must be some understanding issue,
kindly help me as early as possible.
Thanks a lot.