Return-Path: Mailing-List: contact ibatis-user-java-help@incubator.apache.org; run by ezmlm Delivered-To: mailing list ibatis-user-java@incubator.apache.org Received: (qmail 42324 invoked by uid 99); 22 Dec 2004 16:38:50 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from expredir4.cites.uiuc.edu (HELO expredir4.cites.uiuc.edu) (128.174.5.187) by apache.org (qpsmtpd/0.28) with ESMTP; Wed, 22 Dec 2004 08:38:44 -0800 Received: from socsbo3.uiuc.edu (socsbo3.scs.uiuc.edu [130.126.225.186]) by expredir4.cites.uiuc.edu (8.12.11/8.12.11) with ESMTP id iBMGcc18027034 for ; Wed, 22 Dec 2004 10:38:38 -0600 (CST) Message-Id: <6.1.1.1.2.20041222102355.026129c0@express.cites.uiuc.edu> X-Sender: asapp@express.cites.uiuc.edu (Unverified) X-Mailer: QUALCOMM Windows Eudora Version 6.1.1.1 Date: Wed, 22 Dec 2004 10:39:39 -0600 To: ibatis-user-java@incubator.apache.org From: "Albert L. Sapp" Subject: Re: Why are creates auto-committing? In-Reply-To: <16178eb104122207321be7e35d@mail.gmail.com> References: <6.1.1.1.2.20041221154414.026e88d8@express.cites.uiuc.edu> <16178eb104122207171be50ae0@mail.gmail.com> <6.1.1.1.2.20041222092557.025cf590@express.cites.uiuc.edu> <16178eb104122207321be7e35d@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Checked: Checked Clinton, Thanks for getting back to me so quick. As you can probably tell, I have not done this sort of troubleshooting before. I am still trying to track done where some of the functions being called are actually coded. Because of the way our code is broken up, it will take me a while to get the test case done. I want to pull the actual iBATIS code from all the files it is spread out in to make sure it is not something I have incorrectly coded somewhere else. Thanks, Al At 09:32 AM 12/22/2004, you wrote: >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 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 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 > > > >