ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Perry Nguyen <pfngu...@hanhuy.com>
Subject Re: N+1 selects resultMap list is not serializable
Date Sat, 14 Jan 2006 06:16:45 GMT
Larry,

You just gave me the biggest duh moment.  I totally forgot that my 
"Attributes" had to be Serializable and had assumed it was already.  In 
my case, I don't really ever use the "Attributes" class as it's just a 
specialty helper to load up a Properties object in my domain class; so I 
completely overlooked it.

Thanks for the pointer.

Larry Meadors wrote:
> Because whe you serialize Product, the list of Attribute objects
> cannot be serialized, so...kaboom.
> 
> Make Attribute serializable, and it'll work.
> 
> Larry
> 
> 
> On 1/13/06, Perry Nguyen <pfnguyen@hanhuy.com> wrote:
>> I'm having a problem with a simple N+1 selects problem.
>>
>> I have some objects akin to:
>>
>> Product implements Serializable {
>>    List attributes;
>>    String id;
>> }
>>
>> Attributes {
>>    String name;
>>    String value;
>> }
>>
>> and I do something along the lines of
>>
>> <resultMap id="productResults" class="Product" groupBy="id">
>>    <result property="id" column="PRODUCT_ID"/>
>>    <result property="attributes" resultMap="Products.attributeResults"/>
>> </resultMap>
>>
>> When I go to Serialize Product, I end up with a
>> NotSerializableException.  Making 'attributes' transient makes the
>> exception go away.
>>
>> What can I do to make the List serializable?  Or what is a way I can
>> workaround this?
>>
>> Thanks.
>>


Mime
View raw message