ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: Cache issue using discriminator
Date Wed, 02 Nov 2005 14:18:22 GMT
Unfortunately you can't mix lazy loading with serializable caches....

This is not an iBATIS problem, but more of a CGLIB and/or Java problem. I'm
sure we could find some crazy means of managing this, but I'd rather not.
The real solution is to tell Sun that we want dynamic proxies for classes,
just like we have for interfaces....and we want them to be serializable.

Cheers,
Clinton


On 10/31/05, Gary Barlow <garybarlow@hotmail.com> wrote:
>
> I'm using a serialized cache with result maps that contain a
> discriminator.
> This fails with NotSerializableException unless I set
> lazyLoadingEnabled="false". Is this expected?
>
> What effect does setting lazyLoadingEnabled=false have?
>
> Error msg is:
> com.ibatis.common.exception.NestedRuntimeException: Error caching
> serializable object. Cause: java.io.NotSerializableException:
> com.ibatis.sqlmap.engine.mapping.result.loader.LazyResultLoader
> Caused by: java.io.NotSerializableException:
> com.ibatis.sqlmap.engine.mapping.result.loader.LazyResultLoader
>
> SQLMap:
> <sqlMap namespace="Dimension">
>
> <cacheModel id="dimensionGroupCache" type="LRU" readOnly="false"
> serialize="true">
> <flushInterval hours="10"/>
> <property name="size" value="1000"/>
> <flushOnExecute statement="deleteGroup"/>
> <flushOnExecute statement="updateDimensionGroup"/>
> </cacheModel>
>
> <resultMap id="dimensionGroupAbstractResult"
> class="com.manu.tro.service.dimension.model.DimensionGroupAbstract">
> <result property="id" column="DIM_GROUP_ID"/>
> <result property="name" column="NAME"/>
> <result property="dimensionId" column="DIMENSION_ID"/>
> <discriminator column="TYPE" javaType="string">
> <subMap value="Group" resultMap="dimensionGroupResult"/>
> <subMap value="Range" resultMap="dimensionGroupRangeResult"/>
> </discriminator>
> </resultMap>
>
> <resultMap id="dimensionGroupResult"
> class="com.manu.tro.service.dimension.model.DimensionGroup"
> extends="dimensionGroupAbstractResult">
> <result property="dimensionGroupValues" column="DIM_GROUP_ID"
> select="getDimensionGroupValues"/>
> </resultMap>
>
> <resultMap id="dimensionGroupRangeResult"
> class="com.manu.tro.service.dimension.model.DimensionGroupRange"
> extends="dimensionGroupAbstractResult">
> <result property="from" column="FROM_VALUE"/>
> <result property="to" column="TO_VALUE"/>
> </resultMap>
>
> <select id="getDimensionGroup" resultMap="dimensionGroupAbstractResult"
> cacheModel="dimensionGroupCache">
> sql..................
>
>
>

Mime
View raw message