Re: Multiple Statements in one transaction/command
No, I would avoid that. I'm not sure what the appeal is of doing something like this. More XML and less Java? I'm finding the opposite opinion is more common these daysless XML and more Java. In fact, one of the highest priority features of iBATIS 3.0 is XML-less iBATIS. ;-) Cheers, Clinton On 10/26/05, H.E. Sum [EMAIL PROTECTED] wrote: What's a good pattern to perform multiple statementson a single DAO method. Suppose I have a bunch ofUser objects each containing a list of Groupobjects. Right now I'm doing the following: (Pseudocode)AddUser(User) {[BeginTransaction] Mapper.Instance().Insert(InsertUser, user); foreach (Group in user.Groups) {Mapper.Instance().Insert(InsertGroup, group); }[CommitTransaction]Is there a way to move this type of transaction toiBatis. I'm thinking along the lines of a hypotheticalconstruct like:batchStatement id=InsertUserAndGroups useTransaction=true parameterClass=User insert id=InsertUserINSERT INTO user ... /insert foreach property=Groups insert id=InsertGroupINSERT INTO group .../insert /foreach/batchStatementIn the example, the insert statements are the same as usual except they implicitly take the parameterspecified in the batchStatement tag.Is there something like this already in iBatis orplanned for the future, or is this a misguidedstrategy? Thanks,H.E.__Yahoo! Mail - PC Magazine Editors' Choice 2005http://mail.yahoo.com
Re: Multiple Statements in one transaction/command
Clinton Begin wrote: No, I would avoid that. I'm not sure what the appeal is of doing something like this. More XML and less Java? I'm finding the opposite opinion is more common these daysless XML and more Java. In fact, one of the highest priority features of iBATIS 3.0 is XML-less iBATIS. ;-) Please don't fall for the anti-XML hype! I cannot fathom this whole xml is too verbose crap. Yes, it is possible to push too much responsibility into the XML (and yes, alarm bells should be going off when you're talking about putting a logic notion like foreach in XML), but that does not mean we should abandon XML... and for what? Yet another markup language (Ruby-bash fully intended) but without the scary pointy brackets? Hardcoding our configuration in the code? In any case, from one (mostly) satisfied iBatis user, your use of XML is *just fine*! Don't fix what ain't broke! b
Re: Multiple Statements in one transaction/command
Don't worry, we don't intend to abandon XML. But instead, we intend to support a more robust Java API to allow developers to do both full mapped statement configuration from Java, as well as execute ad-hoc SQL statements. Cheers, Clinton On 11/2/05, Ben Munat [EMAIL PROTECTED] wrote: Clinton Begin wrote: No, I would avoid that.I'm not sure what the appeal is of doing something like this.More XML and less Java?I'm finding the opposite opinion is more common these daysless XML and more Java.In fact, one of the highest priority features of iBATIS 3.0 is XML-less iBATIS.;-)Please don't fall for the anti-XML hype! I cannot fathom this whole xml is too verbosecrap. Yes, it is possible to push too much responsibility into the XML (and yes, alarm bells should be going off when you're talking about putting a logic notion like foreachin XML), but that does not mean we should abandon XML... and for what? Yet another markuplanguage (Ruby-bash fully intended) but without the scary pointy brackets? Hardcoding our configuration in the code?In any case, from one (mostly) satisfied iBatis user, your use of XML is *just fine*!Don't fix what ain't broke!b
Re: Multiple Statements in one transaction/command
Clinton Begin wrote: Don't worry, we don't intend to abandon XML. But instead, we intend to support a more robust Java API to allow developers to do both full mapped statement configuration from Java, as well as execute ad-hoc SQL statements. Cheers, Clinton Sounds great! Thanks for the reassurance. :-) b
Multiple Statements in one transaction/command
What's a good pattern to perform multiple statements on a single DAO method. Suppose I have a bunch of User objects each containing a list of Group objects. Right now I'm doing the following: (Pseudocode) AddUser(User) { [BeginTransaction] Mapper.Instance().Insert(InsertUser, user); foreach (Group in user.Groups) { Mapper.Instance().Insert(InsertGroup, group); } [CommitTransaction] Is there a way to move this type of transaction to iBatis. I'm thinking along the lines of a hypothetical construct like: batchStatement id=InsertUserAndGroups useTransaction=true parameterClass=User insert id=InsertUser INSERT INTO user ... /insert foreach property=Groups insert id=InsertGroup INSERT INTO group ... /insert /foreach /batchStatement In the example, the insert statements are the same as usual except they implicitly take the parameter specified in the batchStatement tag. Is there something like this already in iBatis or planned for the future, or is this a misguided strategy? Thanks, H.E. __ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com