You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by JohannesK <jo...@eficode.fi> on 2008/01/16 10:20:02 UTC
Weird cache behaviour in iBatis
Hi
I'm having problems with the caching in iBatis. I'm running ibatis-2.3.0.677
with an Oracle 10g database. Basically if I remove a row in the DB through
iSQL*Plus, it is still present in the iBatis cache. Here's my
sqlMapConfig.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMapConfig
PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
<settings cacheModelsEnabled="false" />
<sqlMap resource="core/Test.xml" />
</sqlMapConfig>
Test.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap
PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap>
<typeAlias type="fi.eficode.lila.core.Test" alias="Test" />
<resultMap id="testResult" class="Test">
<result property="id" column="Id" />
<result property="name" column="Name" />
</resultMap>
<select id="getAllTests" resultMap="testResult">
select * from Test
</select>
<insert id="insertTest" parameterClass="Test">
INSERT INTO TEST
VALUES (#id#, #name#)
</insert>
</sqlMap>
When i run the insert query everything happens as expected and a row appears
in the table 'TEST' and also appears when i run the select query in Java.
Now if i delete the row through iSQL*Plus and run the select in Java again,
I still get the test object as a result. This happens even though I've
deleted the row, turned caching off in iBatis and even tried to call
SqlMapClient().flushDataCache().
What gives?
--
View this message in context: http://www.nabble.com/Weird-cache-behaviour-in-iBatis-tp14875443p14875443.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
Re: Weird cache behaviour in iBatis
Posted by JohannesK <jo...@eficode.fi>.
This was it. Such a stupid oversight but I'd never had caught it because of
my MySQL background. :)
Thanks!
Larry Meadors-2 wrote:
>
> Did you commit the delete in isql*plus?
>
> Larry
>
>
> On Jan 16, 2008 2:20 AM, JohannesK <jo...@eficode.fi> wrote:
>>
>> Hi
>>
>> I'm having problems with the caching in iBatis. I'm running
>> ibatis-2.3.0.677
>> with an Oracle 10g database. Basically if I remove a row in the DB
>> through
>> iSQL*Plus, it is still present in the iBatis cache. Here's my
>> sqlMapConfig.xml:
>>
>> <?xml version="1.0" encoding="UTF-8" ?>
>> <!DOCTYPE sqlMapConfig
>> PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
>> "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
>>
>> <sqlMapConfig>
>> <settings cacheModelsEnabled="false" />
>> <sqlMap resource="core/Test.xml" />
>> </sqlMapConfig>
>>
>> Test.xml:
>>
>> <?xml version="1.0" encoding="UTF-8" ?>
>> <!DOCTYPE sqlMap
>> PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
>> "http://ibatis.apache.org/dtd/sql-map-2.dtd">
>>
>> <sqlMap>
>> <typeAlias type="fi.eficode.lila.core.Test" alias="Test" />
>>
>> <resultMap id="testResult" class="Test">
>> <result property="id" column="Id" />
>> <result property="name" column="Name" />
>> </resultMap>
>>
>>
>> <select id="getAllTests" resultMap="testResult">
>> select * from Test
>> </select>
>>
>> <insert id="insertTest" parameterClass="Test">
>> INSERT INTO TEST
>> VALUES (#id#, #name#)
>> </insert>
>> </sqlMap>
>>
>>
>> When i run the insert query everything happens as expected and a row
>> appears
>> in the table 'TEST' and also appears when i run the select query in Java.
>> Now if i delete the row through iSQL*Plus and run the select in Java
>> again,
>> I still get the test object as a result. This happens even though I've
>> deleted the row, turned caching off in iBatis and even tried to call
>> SqlMapClient().flushDataCache().
>>
>> What gives?
>> --
>> View this message in context:
>> http://www.nabble.com/Weird-cache-behaviour-in-iBatis-tp14875443p14875443.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Weird-cache-behaviour-in-iBatis-tp14875443p14913213.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
Re: Weird cache behaviour in iBatis
Posted by Larry Meadors <lm...@apache.org>.
Did you commit the delete in isql*plus?
Larry
On Jan 16, 2008 2:20 AM, JohannesK <jo...@eficode.fi> wrote:
>
> Hi
>
> I'm having problems with the caching in iBatis. I'm running ibatis-2.3.0.677
> with an Oracle 10g database. Basically if I remove a row in the DB through
> iSQL*Plus, it is still present in the iBatis cache. Here's my
> sqlMapConfig.xml:
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE sqlMapConfig
> PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
> "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
>
> <sqlMapConfig>
> <settings cacheModelsEnabled="false" />
> <sqlMap resource="core/Test.xml" />
> </sqlMapConfig>
>
> Test.xml:
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE sqlMap
> PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
> "http://ibatis.apache.org/dtd/sql-map-2.dtd">
>
> <sqlMap>
> <typeAlias type="fi.eficode.lila.core.Test" alias="Test" />
>
> <resultMap id="testResult" class="Test">
> <result property="id" column="Id" />
> <result property="name" column="Name" />
> </resultMap>
>
>
> <select id="getAllTests" resultMap="testResult">
> select * from Test
> </select>
>
> <insert id="insertTest" parameterClass="Test">
> INSERT INTO TEST
> VALUES (#id#, #name#)
> </insert>
> </sqlMap>
>
>
> When i run the insert query everything happens as expected and a row appears
> in the table 'TEST' and also appears when i run the select query in Java.
> Now if i delete the row through iSQL*Plus and run the select in Java again,
> I still get the test object as a result. This happens even though I've
> deleted the row, turned caching off in iBatis and even tried to call
> SqlMapClient().flushDataCache().
>
> What gives?
> --
> View this message in context: http://www.nabble.com/Weird-cache-behaviour-in-iBatis-tp14875443p14875443.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
RE: Weird cache behaviour in iBatis
Posted by Clinton Begin <cl...@gmail.com>.
iBATIS doesn't cache anything by default. Since you have no caching
configured, there must be some other explanation.
Clinton
-----Original Message-----
From: JohannesK [mailto:johannes.kuusela@eficode.fi]
Sent: January-16-08 2:20 AM
To: user-java@ibatis.apache.org
Subject: Weird cache behaviour in iBatis
Hi
I'm having problems with the caching in iBatis. I'm running ibatis-2.3.0.677
with an Oracle 10g database. Basically if I remove a row in the DB through
iSQL*Plus, it is still present in the iBatis cache. Here's my
sqlMapConfig.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMapConfig
PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
<settings cacheModelsEnabled="false" />
<sqlMap resource="core/Test.xml" />
</sqlMapConfig>
Test.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap
PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap>
<typeAlias type="fi.eficode.lila.core.Test" alias="Test" />
<resultMap id="testResult" class="Test">
<result property="id" column="Id" />
<result property="name" column="Name" />
</resultMap>
<select id="getAllTests" resultMap="testResult">
select * from Test
</select>
<insert id="insertTest" parameterClass="Test">
INSERT INTO TEST
VALUES (#id#, #name#)
</insert>
</sqlMap>
When i run the insert query everything happens as expected and a row appears
in the table 'TEST' and also appears when i run the select query in Java.
Now if i delete the row through iSQL*Plus and run the select in Java again,
I still get the test object as a result. This happens even though I've
deleted the row, turned caching off in iBatis and even tried to call
SqlMapClient().flushDataCache().
What gives?
--
View this message in context:
http://www.nabble.com/Weird-cache-behaviour-in-iBatis-tp14875443p14875443.ht
ml
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.