You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Brandon Goodin (JIRA)" <ib...@incubator.apache.org> on 2005/06/28 21:26:57 UTC

[jira] Commented: (IBATIS-163) cache not flushing if namespace is used in

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

Brandon Goodin commented on IBATIS-163:
---------------------------------------

cacheModel="user-cache" should be cacheModel="User.user-cache"

> cache not flushing if namespace is used in <sqlMap>
> ---------------------------------------------------
>
>          Key: IBATIS-163
>          URL: http://issues.apache.org/jira/browse/IBATIS-163
>      Project: iBatis for Java
>         Type: Bug
>   Components: SQL Maps
>  Environment: OS - Windows XP
>     Reporter: Satish Rao

>
> I have the following xml
> <sqlMap namespace="User">
> 	<cacheModel id="user-cache" type="LRU" readOnly="false" serialize="true">
> 		<flushInterval hours="24"/>
> 		<flushOnExecute statement="User.addUser"/>
> 		<flushOnExecute statement="User.removeUser"/>
> 		<flushOnExecute statement="User.addEmail"/>
> 		<flushOnExecute statement="User.removeUserEmails"/>
> 		<property name="cache-size" value="1000"/>
> 	</cacheModel>
> 	<resultMap id="list-users-result" class="com.fmr.gift.strutsplus.domain.User">
> 		<result property="id" column="UID"/>
> 		<result property="age" column="AGE"/>
> 		<result property="firstname" column="FIRSTNAME"/>
> 		<result property="lastname" column="LASTNAME"/>
> 		<result property="eventsJoined" column="UID" select="getEventsJoinedByUserId"/>
> 		<result property="emails" column="UID" select="getEmailsbyUserId"/>
> 	</resultMap>
> 	<select id="listUsers" resultMap="list-users-result" cacheModel="user-cache">
> 	    SELECT 
> 	    	UID,
> 	        AGE,
> 	        FIRSTNAME, 
> 	        LASTNAME
> 	    FROM 
> 	    	USERS
> 	</select>
> 	<delete id="removeUser" parameterClass="java.lang.Long">
> 	    DELETE FROM 
> 	    	USERS
> 	    WHERE 
> 	    	UID = #value#
> 	</delete>
> </sqlMap>
> The caching works fine for select. But when I delete a user, I expected the cache to be be flushed because of the following entry in cache model - <flushOnExecute statement="removeUser"/>. This does not happen. When I perform removeUser operation, the user list is displayed again and shows the user id that was deleted.
> I removed namespace="User" from <sqlMap> and also the 'User' prefix on <flushOnExecute> and the flushing worked fine.

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