Michael Remijan wrote:
>
> Hi group,
>
> I've just joined the group because I have been
> researching a question for the last few days and
> haven't come up with a satisfactory answer.
>
> I want to write a statefull session bean for a client
> that will provide exclusive access to a set of table
> rows for the client to update.  I've planned on doing
> UserTransaction.begin(), using "select...for update"
> sql statement to lock the rows, and then either
> UserTransaction.commit() or UserTransaction.rollback()
> depending on what button's the client clicks on.
>
> Sounds real simple but has two very big problems I've
> not found satisfactory answers to.

Transactions are intended to be short - meaning they should not encompass a user
interaction - so they are unsuitable for your needs.

The usual way to design an application where a user requires exclusive access to
a set of database records for the duration of a "conversation" is to write a
lock record to the database. By identifying in the lock record:

- the records locked
- the user owning the lock
- the time the lock was obtained (or last used)

it is possible to lock the records in the way you are trying to achieve. Of
course, all applications accessing the database must honour this lock
appropriately.

========================================
Ian McCallion
Alexis Systems Limited
Romsey, UK
Tel: +44 1794 514883
Fax: +44 1794 501692
========================================

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to