[Opensource] some doubts about transaction

Tsanko Stefanov tsanstef at hotmail.com
Fri Aug 2 11:12:18 PDT 2002


Hello guys,

here are some thoughts of mine about the transactions in expresso and the 
DBObject.localConnection:
I noticed that you now handle the presence of localConnectin in 
DBObject.getValidValue(..). At least this is what
if (o instanceof DBObject) {
	DBObject dbo = (DBObject)o;
	if (this.localConnection != null) {
		dbo.setConnection(this.localConnection);
	}
}...
seems to do.
There is another problem though. Let us say that I have started a 
trasnaction. I create record int table A, then a record in table B that uses 
some data from the record in A, then I update record A with the B.id that is 
auto-increment field. However as the transaction is not completed 
DBObject.getValuedDefault will tell you that such a record does not exist. 
Why? Because those values must be either in the cash or in the DB. 
getValuesDefault should use localConnection as well when a trasaction has 
been started.

if(localConnection!=null && !localConnection.getAutoCommit()) {
//do not use cache
} else {
myValues = CacheManager.getItems(getDBName(), cacheName);
}

Now, contemplating on DBObject.getValuedDefault some doubts popped into my 
head. What if someone has added a record in some table X and someone else 
requests the ValidValues for X, and as these had been stored in the cash 
already, the call to ValidValues brings outdated info?
Maybe I am wrong but I just wanted to share my "fears" with you :-).

Regards,
Tzanko

_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx




More information about the Opensource mailing list