ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brandon Goodin <brandon.goo...@gmail.com>
Subject Re: Ibatis Cache not flushing
Date Tue, 28 Jun 2005 17:36:39 GMT
I would recommend using namespaces if your project is of any
significant size. Otherwise you may run into name conflicts between
mapped statements in different sqlmap files.

Brandon

On 6/28/05, Rao, Satish <satish.rao@fmr.com> wrote:
> I removed the namespace from <sqlMap> and it worked just fine.
> 
> Thanks for your help.
> 
> 
> -----Original Message-----
> From: Brandon Goodin [mailto:brandon.goodin@gmail.com]
> Sent: Tuesday, June 28, 2005 1:17 PM
> To: user-java@ibatis.apache.org
> Cc: Rao, Satish
> Subject: Re: Ibatis Cache not flushing
> 
> 
> you are in a namespace.
> 
> try:
> 
> <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>
> 
> Brandon
> 
> On 6/28/05, Nathan Maves <Nathan.Maves@sun.com> wrote:
> > Satish,
> >
> > I am cc'ing the alias to get more help.
> >
> > Nathan
> >
> >
> > On Jun 28, 2005, at 11:04 AM, Rao, Satish wrote:
> >
> > Hi Nathan,
> >
> > Thanks for the prompt reply.
> >
> > I already had caching turned on in the sqlmap config file. Here's the
> file
> > entry
> >
> > <sqlMapConfig>
> > <settings
> >   cacheModelsEnabled="true"
> >   enhancementEnabled="false"
> >   lazyLoadingEnabled="false"
> >   maxRequests="32"
> >   maxSessions="10"
> >   maxTransactions="5"
> >   useStatementNamespaces="false"
> >   errorTracingEnabled="true"/>
> >
> >  <sqlMap
> > resource="com/fmr/gift/strutsplus/dao/ibatis/Event.xml"/>
> >  <sqlMap
> > resource="com/fmr/gift/strutsplus/dao/ibatis/User.xml"/>
> >  <sqlMap
> > resource="com/fmr/gift/strutsplus/dao/ibatis/Stock.xml"/>
> > </sqlMapConfig>
> >
> >
> > -----Original Message--- --
> > From: Nathan Maves [mailto:Nathan.Maves@Sun.COM]
> > Sent: Tuesday, June 28, 2005 1:02 PM
> > To: Rao, Satish
> > Subject: Re: Ibatis Cache not flushing
> >
> > Everything looks good to me.
> >
> >
> > Make sure that you have caching turn on in your sqlmap config file.
> >
> >
> > <settings
> >     cacheModelsEnabled="true"
> >     enhancementEnabled="true"
> >     maxSessions="64"
> >     maxTransactions="8"
> >     maxRequests="128"
> >     useStatementNamespaces="false"/>
> >
> >
> > Nathan
> >
> >
> >
> > On Jun 28, 2005, at 10:57 AM, Rao, Satish wrote:
> >
> >
> >
> > Hi Nathan,
> >
> > I saw your message thread about cache not flushing
> > http://sourceforge.net/mailarchive/message.php?msg_id=9263689
> >
> > How did you resolve this? I am having the same issue.
> >
> > I have the following xml
> >
> > <sqlMap namespace="User">
> >         <cacheModel id="user-cache" type="LRU" readOnly="false"
> > serialize="true">
> >                 <flushInterval hours="24"/>
> >                 <flushOnExecute statement="addUser"/>
> >                 <flushOnExecute statement="removeUser"/>
> >                 <flushOnExecute statement="addEmail"/>
> >                 <flushOnExecute statement="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.
> >
> > Am I doing anything wrong here?
> >
> > Thanks,
> > Satish
> >
> >
>

Mime
View raw message