db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Pendleton <bpendle...@amberpoint.com>
Subject Re: Select records that are not locked?
Date Fri, 06 Jan 2006 17:30:23 GMT
Danny wrote:
> What I was after was a way to build a list of transactions that are 
> available to edit for a user.
> What I don’t want in the list is any transactions that are currently 
> being edited by another user.

I think you should implement this notion of "transaction" within your
application, and be careful not to confuse it with the lower-level
DBMS concept of transaction.

That is, in your application, you should have a transaction table,
and transactions should have a certain state, and a certain lifecycle,
which you can define as appropriate for your application.

Then, when a user is editing a transaction, you update the transaction
state in your transaction table to reflect that this transaction is
currently being edited by this user.

And, when you want to build a list of transactions which are not
currently being edited, you run a select statement which fetches
the rows from your transaction table which are in the appropriate state.



P.S. Regarding the low-level DBMS transaction, I agree with what others
have already said: keep them short and focused; don't hold them open
across UI think periods. Fetch some data from the database, update things
as necessary to reflect that a user is currently working with this data,
then commit that DBMS transaction. Later, when the user issues some
command in the UI, use a separate DBMS transaction to return to those
records and process them accordingly.

View raw message