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