I have a EAI application. need to import data file(csv format) into system.
some of the EAI process may cause more than 20 minutes. So I want to commit after process some data. the code is like this:
Code:
Session sess = factory.openSession();
Transaction tx;
try {
tx = sess.beginTransaction();
[b] while(...){
//do some work
...
tx.commit();
}[/b]
}
catch (Exception e) {
if (tx!=null) tx.rollback();
throw e;
}
finally {
sess.close();
}
Is there any problem ?
If can't use this, how to change the code?