Can this be achievable?
Screen1:
try
If transaction not active
Begin
Session.BeginTrasaction
End
Session.Update(parent)
Session.Flush()
Session.Transaction.Commit()
Except
Session.transaction.rollback
End
Screen2:
If transaction not active
Begin
Session.BeginTrasaction
End
Session.Update(Child)
Session.Flush()
Screen2 is opened from Screen1 and they share the common session object.
When two instances of the same application with above said code is
executed on different rows of the same able, one application waits for
the other to either commit or rollback
Action:
If the first instance does some update (ROW 1) in child screen and comes
back to parent and does not commit.
The second instance of the same application tries to update other row
(ROW 2) of the same table through child screen (Screen2), child screen
hangs until Instance 1 commits or does rollback.
It seems like the instance1 locks the entire table instead of the row it
is updating hence instance 2 hangs until instance 1 rollbacks or
commits.
How can this scenario be achieved and what are the correct steps to be
taken to achieve this design?
Is there any flaw in the code? It seems like NHibernate needs some
locking/ isolation level settings to keep the transaction for long
period unblocking the other transaction to update other rows.
Please comment,
Shanand Chandradas
Sr. Software Engineer | KPIT Cummins Infosystems Ltd.| Ext No.5294 |
Mob: 9730066933
________________________________
From: Shanand Chandradas
Sent: 01 December 2008 12:58
To: 'For users and developers of the Firebird .NET providers'
Subject: Transaction Locking issue
Hello All,
I am using firebird .net provider 2.0 I am facing a basic problem with
transaction locking.
If there are 2 processes of an application running P1 and P2. Consider
the below case:
This design cannot be changed, as the user expects the update to happen
in the child screens and commit to happen in the parent
Process P1 trying to update a record R1 and does not commit, instead
begins the transaction and waits for the user to commit the record. The
order is
Session.Transaction.begin
Session.Update(...)
Session.Flush()
...
..
On parent OK button click user commits the data
Session.Transaction.Commit. The problem is when the user has just
flushed the data in the child screen and yet to commit the data in the
parent screen and at the same time Process P2 also try to flush the
updated record R2 which is not same as R1, process P2 gets blocked by
process P1.
How can it be handled for the user to allow update different records
simultaneously? It seems like NHibernate locks the entire table while
update is performed and uncommitted data is left behind. Is it TRUE?
Please help!!!
Shanand Chandradas
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider