I think Leon is correct with his example, you do not want to rollback
the transaction if no Exception is thrown.
john mcnally
Jon Stevens wrote:
>
> on 7/6/01 12:34 AM, "Leon Messerschmidt" <[EMAIL PROTECTED]> wrote:
>
> > DBConnection dbCon = BasePeer.beginTransaction()
> > try
> > {
> > aLocation.save(dbCon);
> > aCD.save(dbCon);
> > BasePeer.commitTransaction (dbCon);
> > }
> > catch (Exception e)
> > {
> > Log.error (e);
> > BasePeer.rollbackTransaction (dbCon);
> > }
>
> It should be:
>
> catch (Exception e)
> {
> Log.error (e);
> }
> finally
> {
> BasePeer.rollbackTransaction (dbCon);
> }
>
> You want the rollbackTransaction to be in a finally statement in case
> something throws an Exception.
>
> -jon
>
> --
> If you come from a Perl or PHP background, JSP is a way to take
> your pain to new levels. --Anonymous
> <http://jakarta.apache.org/velocity/ymtd/ymtd.html>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]