-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Prob. Deserializing IList implemented entities&collectio
PostPosted: Fri Aug 01, 2008 5:39 am 
Newbie

Joined: Fri Aug 01, 2008 5:21 am
Posts: 2
Location: India
Hi,

We are having collection classes that are hierarchical in nature. The child collections are implemented based on IList which inturn using ICollection, for gathering the related objects.

The parent entity will have the references of the child collections. So we can have hierarchical data collections for implementation.

The issue is when I serialize the collection I can able to do it and I can able to see all the child collections with in the output xml file. But When I try to deserialize the same xml file, I'm getting the following error.

I'm using XMLSerializer for seralizing and deserializing the collections.

Error : {"Could not deserialize global::System.Collections.IList. Parameterless constructor is required for collections and enumerators."}

I could not able to find where is the actual problem is, all my collection classes and entities are having the parameterless constructor within it.

Appriciated if any help on this space.

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 04, 2008 11:40 am 
Newbie

Joined: Fri Jul 25, 2008 6:35 pm
Posts: 6
IList's cannot be serialized/deserialized.

Short awnser is that it's because it is an interface.

The workaround that I had to implement was to use a base class and two parent classes -- one with IList and one with List.

I serialized the IList and used the class with List to deserialize with.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 05, 2008 2:33 am 
Newbie

Joined: Fri Aug 01, 2008 5:21 am
Posts: 2
Location: India
Hi Joe,

Thanks for the reply,

So, do I need to create all the entities with List implementation for the purpose of deserialization? why I'm asking is I'm having 60 classes in my framework, it is too huge in creating the same items with different implementation, when we consider for maintenance it is more complex in maintaing the changes in both the places.

Anyways this is one approach, is there any other workaround for this?

Any help on this regard is highly appreciated.


joe.nguyen wrote:
IList's cannot be serialized/deserialized.

Short awnser is that it's because it is an interface.

The workaround that I had to implement was to use a base class and two parent classes -- one with IList and one with List.

I serialized the IList and used the class with List to deserialize with.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.