[Helma-dev] in-request transaction control

Christian Langreiter chris at langreiter.com
Mon Apr 26 17:53:30 CEST 2004


Per default, Helma wraps every request in a transaction, which means
that changes are committed to the database at the end of a successful
request only.

If an application requires finer control over transactions (e.g. to
ensure that changes are reflected in collections created by database
queries), it's necessary to commit and create a new transaction
while the request is being handled.

Fortunately, Hannes found a very simple solution that doesn't require
any Helma extensions at all:

// ...
// object modification code comes here

// helma.objectmodel.db.Transactor tx
var tx = java.lang.Thread.currentThread();
tx.commit(); 
tx.begin(req.path); 

// code dependent on modifications being committed goes here
// ...

See also: http://gong.helma.org/user+transactions/

Hannes, please correct or expand as seen fit.

-- Chris

(*) That's the first amazing feature being requested and implemented
INSTANTANEOUSLY in the brand-new Helma Jabber conference (group
"helma" on conference.jabber.at). So join in and bring your favourite
feature requests along ;-)



More information about the Helma-dev mailing list