[阅读: 406] 2007-01-26 04:52:23
You need use SAVEPOINT in transaction:
do {
String savepointName = "any string"+class.hasCode();
Savepoint savePoint = conn.setSavepoint(savepointName);
try {
stmt.execute();
success = true;
} catch (SQLException sqle) {
conn.rollback(savePoint);
}
} while (!success);
查了一下jdk Connection的方法,有一个
setSavepoint()
Creates an unnamed savepoint in the current transaction and returns the new Savepoint object that represents it.
我想知道,为什么要这么做?什么原因造成的?
吃点、喝点比啥都强!
