> > Hi,
> >
> > Is there any method to lock some of the rows in a table. I want to
> > lock some rows of a table which are being updated so that nobody else
> > can modify the data. The information about the user who locked a
> > particular row is needed, when tried to find the bean corresponding to
> > that particular row .
>
> >BMP or CMP? Which database?
> >
> >If you are using BMP with Sybase ASE/ASA or MS SQL Server, you can use
> >"select ... from ... holdlock where ..." in your ejbLoad.
>
>How long do you need to hold the lock on the rows ? Is it during a 'normal'
>transaction or across what might be considered normal transaction
>boundaries ? The holdlock will prevent someone upgrading their lock to an
>update lock but I think you want to identify the user who is currently
>holding the lock which is a bit messy. This is very hard to do using
>standard SQL calls and might vary across DBMS's (some DBMS's may give the
>user locking the resource in the SQL error message). You would have to do
>this using application code and I think this is nontrivial unless someone
>out there has a better solution.
From: Rajasekharuni Syam - srajas
>Answer to Part of your question:
>
>The locked table name can be obtained by querying V$locked_object table in
>Oracle.
>
>Another thing, V$open_cursor table can give name of the user who use the
>table that is locked.
>Try finding out which query is locking the table and thereby the rows that
>are being locked.
Assuming we are using Oracle of course :-)..There are other DBMS's out
there which is why I said that how one might trap the error across
different DBMS's might be messy. Of course you can always do a check on the
DBMS being used and then have an interface which will make different DBMS
calls depending on the DBMS. However this also means that the user has to
wait until the timeout or lock has occurred which is a delay...
cheers,
eddie
===========================================================================
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".