[SQLObject] disable caching completely or using Transactions…

Top Page
Author: Kevin Dangoor
To: SQLObject discussion
Subject: [SQLObject] disable caching completely or using Transactions for everything?
I just want to confirm a suspicion that I have. Transactions have
their own CacheSet, and there is *no* interplay between the
Transaction's CacheSet and the DBConnection's CacheSet. So, if you:

    * pull an object from the database
    * switch to a transaction
    * pull the same object from the database
    * update it
    * commit the transaction
    * access that object again outside of the Transaction

you'll end up with stale data. Is that correct?

It seems to me that, when answering requests in a multithreaded
environment, you should do *all* database access in Transactions (a
new one for each request), which gives you a reasonable approximation
of the "unit of work" mode of operation that works well with tools
like Hibernate. If you use Transactions for writing and straight
DBConnections for reading, you could end up with stale data


Kevin Dangoor
Author of the Zesty News RSS newsreader

email: kid@???
company: http://www.BlazingThings.com
blog: http://www.BlueSkyOnMars.com

This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
sqlobject-discuss mailing list