tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From QM <>
Subject Re: method level synchronization doesn't work
Date Thu, 30 Sep 2004 21:43:33 GMT
On Thu, Sep 30, 2004 at 05:31:25PM -0400, Malia Noori wrote:
: Thank you for replying, but I would appreciate it if you could expand on
: your explanation.  Here is my original post:
: Actually, the data that I am modifying requires a transaction and
: > synchronization.  It increments a counter stored in the database.  So, I
: > have to do a select to get the current value, increment the counter, and
: > then insert the new value.

This needn't be done within code; you could perform a database-level
transaction.  For example, using raw SQL calls that would come down to:

	. set the Connection's autoCommit to false
	. do the DB work
	. call the Connection's commit() method

I recall EJBs have their own transaction mechanism, and I'd be
shocked[1] if something as popular as Hibernate didn't have one as well.
Check the respective docs.

Whatever the case, there should be no need to try to synchronize this at
the app/code level.


[1] = I've been shocked before, though... ;)


software  --
tech news --

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message