I have a simple POJO mapped to a table using Hibernate. Which works just fine.
public class Patient implements Serializable {
private int patientId;
private String firstName;
private String lastName;
private Set<Prescription> patientPrescriptions;
public Patient() {}
...
}
My problem is I want to be able to serialize the object so I can get it trough the wire for my GWT-RPC calls. If my async service return this object I get an error:
com.google.gwt.user.client.rpc.SerializationException: Type 'org.hibernate.collection.PersistentSet' 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 suppose this is due to the fact it cannot serialize Set since this is an interface hence not serializable. On the other hand Hibernate needs a collection interface (Set/Map) to work. So this means I can no longer send objects mapped with Hibernate? Is there some "easy" way to serialize a Set?
Thank you.