List:       ojb-dev
Subject:    Need Quick Help !! Production Issue
From:       Somendra Paul <som_paul () yahoo ! com>
Date:       2008-06-29 5:50:00
Message-ID: 460133.22050.qm () web54605 ! mail ! re2 ! yahoo ! com
[Download RAW message or body]

These are the following java objects that we store:
 
Wip  --> Wip Process(related table of Wip) -> Wip Qty (related table of Wip)
Lot --> Lot Qty(related table of Lot) -> Lot Process Location(related table of Lot)
Shipment 
 
The way our code works is this Wip,Lot,Shipment data are kept in csv files, they are \
then converted to thier respective java objects and then  persisted to the DB, one by \
one.  
Suppose a file  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  any sequence, and \
not that first 100 Lot and then 100 Wip and then Shipment.  
 
Suppose our file has Lot, Shipment and then Wip:
 
Current Problem: 
Our setting in repository-database.xml is batch-mode is true,and autoComit is 2 and \
when the three objects are persisted, we find that sometimes and that is quite rare, \
that the some of the objects are actually not persisted in DB, though there is no \
exception in logs, we are using OJB1.0.4.
 
Current Code Behaviour of Code: -->
The way our code works is we get the transaction from the PB broker, and then start \
the transaction and then insert the Lot object,afterthat they  will 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. store(pc) for each LotQty or Lot \
Process Location and then call batchUpdate (intention being that the since for a \
single lot , there are multiple lot qty objects it 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 and in the code for every Shipment we dynamically \
generate a Wip record and save the record to DB, as similar to Lot, wip will have \
WippROCESSLocation and WipQty 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 andthen commit or rollback the transaction.
 
Second way the same behaviour can be achieved in our code-->
 
We get the transaction ,start the transaction, and start the batch Mode to true, \
after making all the Lot,LotQty, Lot Process Location persistent and then make  the \
executeBatch call and then do the same for Shipment ie make the batchMode to true and \
then persist Shipment, dynamic Wip and then again call batch Update and similar for \
Wip and then commit or rollback the transaction.  
One question 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, Lot Process \
Location ,Shipment, dynamic Wip and then Wip, Wip Qty,WipProcess Location, and then \
call batch Update, what i found is that process Shipment if we need to find that if \
the Lot object is there in DB, then it was unable to acess the Lot Object, i am not \
able to understand why ??  
 
Third Approach:--> Have batch Update to false in repository_database.xml, and then \
start the txn, call Lot,LotQty,Lot process location,Shipment and 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  to use the batch mode features to ehance the \
performance.  
What is wanted to know :--.>
 
What i want to know is is the current way of writting hte batch Update is correct, or \
something is wrong, which is causing hte issue mentioned.  
Is the second approach correct, if and why ?
 
Is the performance of the third approach almost similar the second or will be the \
very bad.


      

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org



Configure | About | News | Add a list | Sponsored by KoreLogic