Unfortunately there's way too much non-iBATIS code in your example.
We can't really see what's going on. What is .create(...) ? What is
commitTransaction() ?
I recommend writing a simpler test case for yourself using a single
method and only iBATIS code within it. Then, if that doesn't work we
can help you.
Cheers,
Clinton
On Wed, 22 Dec 2004 09:29:30 -0600, Albert L. Sapp <[EMAIL PROTECTED]> wrote:
> Using Oracle 10g and the thin driver for it. Also, using Tomcat
> application server on top of RHEL AS 3.
>
> At 09:17 AM 12/22/2004, you wrote:
> >Which RDBMS are you using?
> >
> >
> >On Tue, 21 Dec 2004 15:57:07 -0600, Albert L. Sapp <[EMAIL PROTECTED]> wrote:
> > > I am new to ibatis and using DAO and sqlMaps. I am trying to perform
> > > multiple creates in a function and having them rollback if one of them
> > > fails. The rollback does not seem to be performed. Instead the creates
> > > up
> > > to that point are committed. I apparently am not clear on what
> > controls the
> > > commitment or rollback of multiple creates. Here is the section of code
> > > from my program. I am hoping that you can point out to me what I am doing
> > > wrong.
> > >
> > > try
> > > {
> > > //Everything checks out, so add the new unit.
> > > logger.finer("Starting transaction.");
> > > startTransaction();
> > >
> > > logger.finer("Creating unit manager role.");
> > > roleDAO.create(namedUnitManagerRole);
> > >
> > > logger.finer("Creating unit staff role.");
> > > roleDAO.create(namedUnitStaffRole);
> > >
> > > logger.finer("Creating unit manager user.");
> > > userDAO.create(manager);
> > >
> > > logger.finer("Granting unit manager role to
> > > user.");
> > > userRoleDAO.create(userRole);
> > >
> > > logger.finer("Creating Unit.");
> > > unitDAO.create(newUnit);
> > >
> > > logger.finest("Create unit/unit type
> > > cross-references.");
> > > for ( int i = 0; i < unitToTypes.length; i++)
> > > {
> > > UnitToType newUnitToType = new
> > > UnitToType();
> > > newUnitToType =
> > (UnitToType)unitToTypes[i];
> > >
> > > unitToTypeDAO.create(newUnitToType);
> > >
> > > logger.finest("Added UnitToType: " +
> > > newUnitToType);
> > >
> > > newUnitToType = null;
> > > }
> > >
> > > commitTransaction();
> > > }
> > > catch(DuplicatePK e)
> > > {
> > > try { endTransaction(); } catch (DaoException e1)
> > > {/*ignore*/}
> > > throw new ItemExists("This unit already
> > > exists.",e);
> > > }
> > > catch(DuplicateConstraint e)
> > > {
> > > try { endTransaction(); } catch (DaoException e1)
> > > {/*ignore*/}
> > > DuplicateDescription e1 = new
> > > DuplicateDescription("Duplicate unit data in another record.",e);
> > > e1.setFieldName(e.getFieldName());
> > > throw e1;
> > > }
> > > catch(NullConstraintViolation e)
> > > {
> > > try { endTransaction(); } catch (DaoException e1)
> > > {/*ignore*/}
> > > NullFields e1 = new NullFields("A unit field has
> > > been left empty that should not be empty.",e);
> > > e1.setFieldName(e.getFieldName());
> > > throw e1;
> > > }
> > > catch(DaoException e)
> > > {
> > > try { endTransaction(); } catch (DaoException e1)
> > > {/*ignore*/}
> > > throw new ManagerException("Dao Exception in
> > trying
> > > to create new unit." + e.getCause(),e);
> > > }
> > > finally
> > > {
> > > endTransaction();
> > > }
> > >
> > > Thanks,
> > >
> > > Al Sapp
>
>