Michael:
Thanks for your reply. Yes I looked at that page and I am using that approach to retrieve the data.
What I need now is how to save the objects that will be persisted on Oracle within the same transaction that is pulling the records from DB2.
This is a bit of pseucode of what I am doing
List oraObjs = new ArrayList();
Session session = as400Session
ScrollableResults results = ...
while(results.next() ){
//Load the object from the AS400 side
As400Obj obj = (AS400Obj)results.get(0);
//compose Oracle object
OracleObj oraObj = new OraObj();
BeanUtils.copyProperties(oraObj, obj);
//load the ora object into a list
oraObjs.add(oraObj);
//if the batch size threshhold is met clear the session, flush it and flush the oraObjs List
session.flush();
session.clear();
oraObjs.clear();
}
//Here is where I need to obtain another hibernate session that is configured for Oracle so that I can do something like:
oraDao.saveObjs(oraObjs);
//I'd like for this to occur within the same transaction so that if something goes wrong on the AS400 side, nothing will be committed on the oracle side.
Thanks in advance,
Juan Alvarado
|