ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adrian Harrison" <adrianharrison...@yahoo.co.uk>
Subject Force cache refresh?
Date Tue, 13 Dec 2005 14:34:13 GMT
I have a cached sql statement as follows - 

	<sqlMap namespace="PicklistCached">
	
		<cacheModel id="picklist-cache" type="MEMORY">
			<flushInterval hours="24"/>
			<property name="reference-type" value="STRONG"/>
		</cacheModel>
	
		<resultMap id="lookupResult" class="lookup">
			<result property="lookupID" column="ID"/>
			<result property="lookupDescr" column="DESCR"/>
		</resultMap>
	
		<statement id="getCommentTypeList" resultMap="lookupResult"
cacheModel="picklist-cache">
			SELECT * FROM comment_type
			ORDER BY descr
		</statement>
	 
	</sqlMap>

This is called like so - 

	public class PicklistDao extends SqlMapDaoTemplate
	{
	    public PicklistDao(DaoManager daoManager)
	    {
	        super(daoManager);
	    }

	    public List getCommentTypeList()
	    {
	        return executeQueryForList("getCommentTypeList", null);
	    }
	
	    protected List executeQueryForList(String statementName, Object
parameterObject)
	    {
	        SqlMapExecutor sqlMap = getSqlMapExecutor();
	        
	        try
	        {
	            return sqlMap.queryForList(statementName,
parameterObject);
	        } catch (SQLException e)
	        {
	            throw new DaoException("Error executing query for list.
Cause: " + e, e);
	        }
	    }
	}

A future requirement is that this table will need to be updated (but very
infrequently) - so I'll have something like - 

	<update id="updateCommentType" parameterClass="projectcomment">
		UPDATE comment_type SET
			descr = #descr#
		WHERE
			id = #id# 
	</update>

is there a way to still use the cacheing & instruct ibatis to refresh the
cache after updateCommentType is called? 

Thanks in advance

(hope I've made some sense!)


		
___________________________________________________________ 
Yahoo! Exclusive Xmas Game, help Santa with his celebrity party - http://santas-christmas-party.yahoo.net/

Mime
View raw message