db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject Re: Select records that are not locked?
Date Fri, 06 Jan 2006 23:00:50 GMT
On Jan 6, 2006, at 9:30 AM, Bryan Pendleton wrote:

> 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.

+1. This is an application-level concept that can be implemented  
using the techniques below.

> 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.
> thanks,
> bryan
> 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.

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!

View raw message