• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Still serialization problem with DTO

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 11445
18
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.
Difficult to say without seeing any code. Could you please show us your ActivityDTO (Just make sure you UseCodeTags)
 
Mark Pereira
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 11445
18
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 11445
18
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
If you settle for what they are giving you, you deserve what you get. Fight for this tiny ad!
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!