Hi Shawn,
> > If you set connection.setAutoCommit(false) to open a transaction, and
> > then, if
> > you notice that your set of queries fail, then you should also call the
> > connection.rollback() operation to discard them.
> > On-the-fly example (hope it works ;^):
> >
> 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;
> }
>
>
> In this case then you wouldn't need con.setAutoCommit(true); --would
> you?
Yes, I *suppose*, but I never tested this statement.
I could tell if a transaction is started into an interceptor BUT not terminated
here, a DENY_OPERATION return code should produce a rollback for any
(interceptor's) opened transaction, while the GRANT_OPERATION should do a
commit.
Luca
-------------------------------------------------------
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