Need Quick Help !! Production Issue
Somendra Paul <[email protected]> Sat, 28 Jun 2008 22:50:00 -0700 (PDT)
| Newsgroups | gmane.comp.jakarta.ojb.devel |
|---|---|
| Message-ID | <[email protected]> |
These are the following java objects that we store:=0A=A0=0AWip=A0 --> Wip = Process(related table of Wip) -> Wip Qty (related table of Wip)=0ALot --> L= ot Qty(related table of Lot) -> Lot Process Location(related table of Lot)= =0AShipment =0A=A0=0AThe way our code works is this Wip,Lot,Shipment data a= re kept in csv files, they are then converted to thier respective java obje= cts and then =0Apersisted to the DB, one by one.=0A=A0=0ASuppose a file=A0 = can contain 100 Lot, 100 Wip, and 100 Shipment and they can be interlaced, = what i mean is that Lot,Wip and Shipment can come in =0Aany sequence, and n= ot that first 100 Lot and then 100 Wip and then Shipment.=0A=A0=0A=A0=0ASup= pose our file has Lot, Shipment and then Wip:=0A=A0=0ACurrent Problem: =0AO= ur setting in repository-database.xml is batch-mode is true,and autoComit i= s 2 and when the three objects are persisted, we find that=0Asometimes and = that is quite rare, that the some of the objects are actually not persisted= in DB, though there is no exception in logs,=0Awe are using OJB1.0.4.=0A= =A0=0ACurrent Code Behaviour of Code: -->=0AThe way our code works is we ge= t the transaction from the PB broker, and then start the transaction and th= en insert the Lot object,afterthat they =0Awill persist the Lot Qty and Lot= Process Location objects which are information related to lot, by setting = the batch mode to true and then calling broker.=0Astore(pc) for each LotQty= or Lot Process Location and then call batchUpdate (intention being that th= e since for a single lot , there are multiple lot qty objects=0Ait would be= better to use batch updates for such objects ) and then set back the batch= mode to false again. The Shipment record comes gets inserted=0Aand in the = code for every Shipment we dynamically generate a Wip record and save the r= ecord to DB, as similar to Lot, wip will have WippROCESSLocation=0Aand WipQ= ty which are saved by doing again batch Update,and again setting the batch = update to false,and then the Wip record will go to DB as explained above=0A= andthen commit or rollback the transaction.=0A=A0=0ASecond way the same beh= aviour can be achieved in our code-->=0A=A0=0AWe get the transaction ,start= the transaction, and start the batch Mode to true, after making all the Lo= t,LotQty, Lot Process Location persistent and then make =0Athe executeBatch= call and then do the same for Shipment ie make the batchMode to true and t= hen persist Shipment, dynamic Wip and then again call=0Abatch Update and si= milar for Wip and then commit or rollback the transaction.=0A=A0=0AOne ques= tion in this approach is that if I had written the code in such a way that = we start the transaction , start the batch mode, and then save Lot,Lot Qty,= =0ALot Process Location ,Shipment, dynamic Wip and then Wip, Wip Qty,WipPro= cess Location, and then call batch Update, what i found is that process Shi= pment=0Aif we need to find that if the Lot object is there in DB, then it w= as unable to acess the Lot Object, i am not able to understand why ??=0A=A0= =0A=A0=0AThird Approach:--> Have batch Update to false in repository_databa= se.xml, and then start the txn, call Lot,LotQty,Lot process location,Shipme= nt=0Aand dynamic Wip, Wip ,Wip Qty,Wip Process Location,and then commit or = rollback the transaction, but then in this way we will not be able =0Ato us= e the batch mode features to ehance the performance.=0A=A0=0AWhat is wanted= to know :--.>=0A=A0=0AWhat i want to know is is the current way of writtin= g hte batch Update is correct, or something is wrong, which is causing hte = issue mentioned.=0A=A0=0AIs the second approach correct, if and why ?=0A=A0= =0AIs the performance of the third approach almost similar the second or wi= ll be the very bad.=0A=0A=0A