Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Transaction Issue while maintaining sum

Re: Transaction Issue while maintaining sum

From: Puneet Agarwal <NOSPAM__puneetagarwal_at_india.com>
Date: Thu, 8 Nov 2001 21:42:47 +0530
Message-ID: <9seaqf$13go4n$1@ID-99266.news.dfncis.de>


Thanks for the reply and your advice.

I am sorry I was not clear in noting my problem but you somehow came very near to it. The problem is I am trying to allow user interactions in middle of a transaction, Which will create this problem. Now, as you have suggested that I should cache the things at client side and send the data to the server in one transaction in a batch, I have some questions regarding that.

Lets take the voucher scenario again, where I wanted to create the voucher row as soon as the user opens the voucher form. I want to do this to be able to immediately enforce the Business Logic as soon as the data is entered so that user immediately nows that he is entering illegal data. For example, if cash balance has been constrained to be never less than zero, a user will not be allowed to enter a voucher which reduces cash balance below zero. Another thing, I want to do is that whatever dependencies are there on the basis of users input, I want it to be reflected every where in the interface as soon as it is entered rather than when it is committed. For example, If user is viewing a Trial Balance(List of balances of all accounts) in another window and entering a voucher in another window, I want the impact of the users entry to be immediately visible in the TrialBalance window. This is far too complicated to be handled at the client side because the effect of the users actions is implemented in business logic which resides on the server side. How do I handle this.

And can you please refer me a resource where I can get further information that using client server architecture the way I am using is not appropriate or any other solutions for my requirement.

Thanks
Puneet

You might be right in saying I am not using client server architecture properly.

But I have some doubts regarding that.

"Ivan Arjentinski" <ivanarj_at_aloeco.com_> wrote in message news:O257BdGaBHA.2408_at_tkmsftngp05...
> Puneet,
>
> In my opinion you failed to note what is your problem.
>
> > transaction will hold a lock on the corresponding account table row. And
> now
> > if the second user tries to update that row, he will find the row locked
> and
> > thus he will not be allowed to feed the voucher till the first user
> commits
> > his data and releases the lock.
> This behaviour is by default. It should not be a problem for you. As soon
as
> the first user transaction finishes creating the voucher lines (this
should
> be very fast), the second user transaction will proceed automatically.
>
> I think that you might be misusing the client/server architecture as a
> general. Maybe you start creating the voucher row (and the transaction)
> immediately as the client starts entering. Instead, you should cache the
> whole voucher at the client and when it is complete send it as a single
> batch (transaction) to the server.
>
> NEVER, NEVER, NEVER do allow user interactions while in transaction!
>
> Hope this helps,
> Ivan Arjentinski
> ----------------------------------------------------------------------
> Please reply to newsgroups. Inclusion of table schemas (CREATE TABLE
> scripts), sample data (INSERT INTO....) and desired result set when asking
> for assistance is highly appreciated
> ----------------------------------------------------------------------
>
> "Puneet Agarwal" <NOSPAM__puneetagarwal_at_india.com> wrote in message
> news:9se6g0$12t0l9$1_at_ID-99266.news.dfncis.de...
> > I am seriously stuck in a transaction handling issue.
> >
> > I have following tables
> >
> > Account
> > AccountId INT PK
> > AccountName String
> > Balance INT PK
> >
> >
> >
> > Voucher
> > VoucherId INT PK
> > VoucherDate Date PK
> >
> >
> > VoucherDetails
> > VoucherDetailId Int PK
> > VouhcerId INt FK for Voucher Table
> > AccountId INT FK for Accounts Table
> > Amount INT
> >
> > I have a Java Swing based thick client through which I want the users to
> > enter data into these tables. Users need to simultaneously create
vouchers
> > which may corresponding to same account. Users need the capability to
> > save(commit) or undo(rollback) changes on the voucher level. Each entry
in
> > voucher may have many entries in voucherdetails. I want to use a trigger
> on
> > voucherDetail table insert/delete/update operations so that i can update
> the
> > balance column in the account table accordingly. But in case two users
are
> > feeding data concurrently and they happen to start feeding a voucher
which
> > contains entry for same account in voucherDetails, the first users
> > transaction will hold a lock on the corresponding account table row. And
> now
> > if the second user tries to update that row, he will find the row locked
> and
> > thus he will not be allowed to feed the voucher till the first user
> commits
> > his data and releases the lock.
> >
> >
> > Kindly suggest me a solution for this scenario. The requirement is very
> > important for me that the users should be able to commit/rollback the
> > changes on voucher level which may include many rows in voucherDetails
> > table.
> >
> >
> > Thanks
> >
> > Puneet
> >
> >
> >
> >
>
>
Received on Thu Nov 08 2001 - 10:12:47 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US