[ http://issues.apache.org/jira/browse/IBATIS-93?page=all ]
     
Clinton Begin closed IBATIS-93:
-------------------------------

    Fix Version: 2.1.0
     Resolution: Cannot Reproduce
      Assign To: Clinton Begin

Can't reproduce this.  4 unit tests verify this functionality works.

> flushOnExecute doesn't work when statement executed in batch
> ------------------------------------------------------------
>
>          Key: IBATIS-93
>          URL: http://issues.apache.org/jira/browse/IBATIS-93
>      Project: iBatis for Java
>         Type: Bug
>   Components: SQL Maps
>     Versions: 2.0.9
>  Environment: Java 1.4.2 Tomcat 5 Window 2003 SQL Server 2000 with SP3a
>     Reporter: Amad Fida
>     Assignee: Clinton Begin
>      Fix For: 2.1.0

>
> I have my sql map defined as follows,
>  <cacheModel id="roleCache" type="LRU" readOnly="false" serialize="true">
>    <flushInterval hours="24"/>
>    <flushOnExecute statement="insertRole"/>
>    <flushOnExecute statement="updateRole"/>
>    <flushOnExecute statement="deleteRole"/>
>    <flushOnExecute statement="deleteAllRoles"/>
>    <property name="size" value="200"/>
>  </cacheModel>
>  <insert id="insertRole">
>    INSERT INTO ROLES
>    (roleKey, roleName, roleDescription, roleComments, createUser,
> updateUser, createDate, updateDate)
>    VALUES
>    (#roleKey#, #roleName#, #roleDescription#, #roleComments#,
> #createUser#, #updateUser#, #createDate#, #updateDate#)
>  </insert>
> there are other statements as well but this will explain my problem.
> When I execute "insertRole" with a SqlMapExecutor.executeBatch(), my
> cache doesn't get flush. Is not suppose to do that or am I missing
> something.
> I am using it along with springframework and here is my code snippet,
>         getSqlMapClientTemplate().execute(new SqlMapClientCallback() {
>             public Object doInSqlMapClient(SqlMapExecutor executor) throws 
> SQLException {
>                 String statementId = "updateRole";
>                 if (isNew) {
>                     statementId = "insertRole";
>                 }
>                 executor.startBatch();
>                 Iterator iter = roles.iterator();
>                 while (iter.hasNext()) {
>                     Role role = (Role)iter.next();
>                     executor.update(statementId, role);
>                 }
>                 int rowsaffected = executor.executeBatch();
>                 if (logger.isDebugEnabled()) {
>                     logger.debug("Rows afftected by batchUpdateRoles (" +
>                                  (isNew ? "isnert" : "update") + ") : " +
>                                  rowsaffected);
>                 }
>                 return null;
>             }
>         });

-- 
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

Reply via email to