Correct me if I'm wrong, but couldn't the code synchronize on a static
final member of the jsp?
private static final String COUNTER_INCREMENT_LOCK = newString("lock");
and then you would use the second method from the first post to synchronize on?
(It's been a long time since I considered synchronization so I could
be really wrong here...)
Mike Fuellbrandt
On Thu, 30 Sep 2004 16:43:33 -0500, QM <[EMAIL PROTECTED]> wrote:
> 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.
>
> -QM
>
> [1] = I've been shocked before, though... ;)
>
>
>
>
> --
>
> software -- http://www.brandxdev.net
> tech news -- http://www.RoarNetworX.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]