You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "S Boyd (JIRA)" <ib...@incubator.apache.org> on 2005/09/19 16:22:29 UTC

[jira] Commented: (IBATIS-155) Dependencies for statements in sql-Maps

    [ http://issues.apache.org/jira/browse/IBATIS-155?page=comments#action_12329851 ] 

S Boyd commented on IBATIS-155:
-------------------------------

I think this is a valid request especially in the case where saving an object requires updates to association tables.  For example, updating a group may require adding/removing users from the group_user table.  I think it would be cleaner to issue one dao call from the service layer update("updateGroup",groupObj) which calls the appropriate sqlmaps instead of issuing three calls to the dao (1 to update the group, 1 to add user, and 1 to delete users).  The latter requires the service layer to "know" to some extent how the database is structured.  Therefore, I think the former way hides that implementation detail.

I don't believe stored procedures solve this problem mentioned because you have variable length arguments passed in every time.  



> Dependencies for statements in sql-Maps
> ---------------------------------------
>
>          Key: IBATIS-155
>          URL: http://issues.apache.org/jira/browse/IBATIS-155
>      Project: iBatis for Java
>         Type: New Feature
>   Components: SQL Maps
>  Environment: all
>     Reporter: Steffen Legler
>     Priority: Minor

>
> i am using ibatis with ~120 sql-Maps.
> When a java object arrives, the software should call in most cases a select and update statement. This works fine.
> But there are other cases, where the software should call for example an insert statement before calling an update-statetement.
> I think it would be useful, if there is an attribute like depends added to the xml-tags statement, insert, update, delete, so that ibatis automatically executes the insert statement when calling the update-statement. 
> For example:
> 	<insert id="insert" parameterClass="class1">
> 		insert into....
> 	</insert>
>   	<update id="update" parameterClass="class1" depends="insert">
> 		update ...
> 	</update>
> Java-execute:
>     sqlMapClient.update("namespace:update",class1);
> In this case the software tries to execute the statement "namespace:update" and ibatis executes two statements:
>   namespace:insert
>   namespace.update
> The advantage of this solution is, that you are not depending on the support of multiple sql-Statements from the jdbc-driver.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira