If you wanted the transactions before the main one to roll back in the case that the main one failed, wouldn't you have to do
So in this case if you have an interceptor like:
public int preInsert(HttpServletRequest request, Hashtable fieldValues,
DbFormsConfig config, Connection con)
throws ValidationException {return orderShip(fieldValues);
}
public int orderShip (String productId, String orderId) { boolean ok = true; try { con.setAutoCommit(false); updateOrderItem(productId, orderId); con.commit(); } catch (SqlException ex) { ok= false; // con.rollback(); } finally { //if (con != null) //con.close();
} if (ok) return GRANT_OPERATION; else return DENY_OPERATION; }
If you make it null in orderShip, it won't do the main transaction will it.
I thought the task was to do a few things before the main dbforms insert. In that case, you can't make the connection null before dbforms insert get a chance to use it can you? Or can you?
The controller then calls cleanUpConnectionAfterException(con) method that:
- checks if the current connection belongs to an open transaction (con != null) && (!con.getAutoCommit())
- if yes, calls con.rollback(); con.setAutoCommit(true); to discard transaction db operations and set the autoCommitMode to ON to prevent to add more operations into the transaction queue.
-- Shawn
Happily using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
------------------------------------------------------- This SF.net email is sponsored by: The SF.net Donation Program. Do you like what SourceForge.net is doing for the Open Source Community? Make a contribution, and help us add new features and functionality. Click here: http://sourceforge.net/donate/ _______________________________________________ DbForms Mailing List
http://www.wap-force.net/dbforms
