This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes GWT and the fly likes Still serialization problem with DTO Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » GWT
Bookmark "Still serialization problem with DTO" Watch "Still serialization problem with DTO" New topic
Author

Still serialization problem with DTO

Mark Pereira
Greenhorn

Joined: Aug 01, 2011
Posts: 4
Hey everyone.

I made DTOs to get over the serialization problem and still have the same error:
Caused by: com.google.gwt.user.client.rpc.SerializationException: Type 'com.client.ActivityDTO' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized.:

I have the entities with annotations in a shared package (client and server) and have dtos in client side. I have an empty contructor in all entities and they are all serialized.

Can anybody help me? I am getting desperate with this.

Thanks, Mark
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10175
    
    8

Welcome to the Ranch.
Difficult to say without seeing any code. Could you please show us your ActivityDTO (Just make sure you UseCodeTags)

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Mark Pereira
Greenhorn

Joined: Aug 01, 2011
Posts: 4
Hey, thanks for your answer. Below I put the ActivityDTO class. I have this in client package like the others DTOs.
The entities but with hibernate annotations are in another package (shared), and when I make the query in server service class and return the object appears the serialization error.
Thanks for trying to help ;)

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10175
    
    8

So you got ComponentDTO ActivityLockDTO ActivityTypeDTO ActivityPermissionDTO inside your ActivityDTO.
Do all these DTOs implement Serializable and and an default constructor?

The entities but with hibernate annotations are in another package (shared)

I am not sure I understand this. Do your DTO have hibernate annotations?

Mark Pereira
Greenhorn

Joined: Aug 01, 2011
Posts: 4
yes, all of my DTOs implement Serializable and have a no-args constructor.

My DTOs in client side dont have hibernate annotations, but entity classes in another package have, cause I need them.

I really dont know what to try more...

Maneesh Godbole wrote:So you got ComponentDTO ActivityLockDTO ActivityTypeDTO ActivityPermissionDTO inside your ActivityDTO.
Do all these DTOs implement Serializable and and an default constructor?

The entities but with hibernate annotations are in another package (shared)

I am not sure I understand this. Do your DTO have hibernate annotations?

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10175
    
    8

Entities are the classes you get from Hibernate. They have hibernate related and other annotations.
DTOs are the POJOs which correspond with these Entities. DTOs are serializable and do not have any annotations.

Where are your entity classes? Under server?
Do you have a converter code or some other facility which converts Entity<->DTO?

Remember, everything under shared has to be serializable, and the source code should be available for the GWT compiler, including the source code for annotations.
Mark Pereira
Greenhorn

Joined: Aug 01, 2011
Posts: 4
Hey! It works! I was doing everything fine but I dont know why Netbeans was not generating well rpc file I tried with Eclipse and it works, after using GWT Compiler.

Thanks for your attention,
Marco


Maneesh Godbole wrote:Entities are the classes you get from Hibernate. They have hibernate related and other annotations.
DTOs are the POJOs which correspond with these Entities. DTOs are serializable and do not have any annotations.

Where are your entity classes? Under server?
Do you have a converter code or some other facility which converts Entity<->DTO?

Remember, everything under shared has to be serializable, and the source code should be available for the GWT compiler, including the source code for annotations.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Still serialization problem with DTO
 
Similar Threads
[Help] Sending List<String> via Socket.
Clustering an application by jboss produced this:
Establishing two-way buffered streams
When to use DTOs and not serialize mapped POJOs...
Object reference graphs containing cycles can be serialized??