I'd recommend to either use one of the standard collections in the session or
a LoadableDetachableModel and save the items in a DB, but that depends on
your usecase. i personally do the model approach as it keeps my session slim
and avoids hibernate's lazyinitexceptions when dealing with the model
objects between requests ...


TH Lim wrote:
> 
> No that not the reason. The reason I need to keep the items each user has
> entered. I can be a List or Map but for this case linkedlistmultimap works
> best for me. Do you have a better alternative? I would like to how know to
> improve this.
> 
> 
> Michael Sparer wrote:
>> 
>> So you're putting an object into your session just because on of its
>> public methods returns a not-serializable object?
>> 
>> 
>> TH Lim wrote:
>>> 
>>> No, linkedlistmultimap  is serializable. only $1 is not. If you look at
>>> the snippet the $1 class is created on the fly when
>>> linkedlistmultimap.get(...) is invoked.
>>> 
>>> 
>>> Michael Sparer wrote:
>>>> 
>>>> but if you save the linkedlistmultimap (which isn't serializable,
>>>> right?) in the session you'll run into problems as well ... at the
>>>> latest in a clustered environment ....
>>>> 
>>>> 
>>>> 
>>>> TH Lim wrote:
>>>>> 
>>>>> No, I didn't save the provider in the session. Just the
>>>>> LinkedListMultimap instance. As Martijn has pointed it out with the
>>>>> code snippet why $1 is not serializable, the only way is to keep the
>>>>> LinkedListMultimap  and not the List.
>>>>> 
>>>>> Wicket is pretty good. It points to the exact field where the problem
>>>>> was.
>>>>> 
>>>>> Thanks guys. 
>>>>> 
>>>>> 
>>>>> Michael Sparer wrote:
>>>>>> 
>>>>>> you save the provider to the session? that's kind of an anti-pattern
>>>>>> as it gets serialized there anyway (at least in a clustered
>>>>>> environment). you should rather boil down to the field that causes
>>>>>> the not-serializable exception, wicket tells you exactly which field
>>>>>> it is anyway. or provide us some code to help you. but if you inherit
>>>>>> from sortabledataprovider or you implement IDataProvider it shouldn't
>>>>>> be too difficult to find out which field it is ;-)
>>>>>> 
>>>>>> regards,
>>>>>> Michael
>>>>>> 
>>>>>> TH Lim wrote:
>>>>>>> 
>>>>>>> I tried another method. Instead of passing the reference to my
>>>>>>> IDataProvider implementation, MyDataProvider, I recode
>>>>>>> MyDataProvider to get it from the MySession which extends Wicket
>>>>>>> Session. I don't any difference here but it works. I still not sure
>>>>>>> what caused MyDataProvider to fail to persist because of the List
>>>>>>> instance it contained.  
>>>>>>> 
>>>>>>> Btw, 
>>>>>>> http://google-collections.googlecode.com/svn-history/r5/trunk/src/com/google/common/collect/LinkedListMultimap.java
>>>>>>> LinkedListMultimap  uses the inner class Node which is also
>>>>>>> Serializable.
>>>>>>> 
>>>>>>> 
>>>>>>> Michael Sparer wrote:
>>>>>>>> 
>>>>>>>> The Serlializable-check isn't sufficient. you can mark any class
>>>>>>>> serializable if you want. what really counts is that all fields of
>>>>>>>> the class are serializable, you should have a look at them ...
>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 


-----
Michael Sparer
http://talk-on-tech.blogspot.com
-- 
View this message in context: 
http://www.nabble.com/Unable-to-serialize-class-com.google.common.collect.LinkedListMultimap%241-tp19027449p19034542.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to