title: Serializable Hibernate data object for GWT RPC
body: <p>I have a simple POJO mapped to a table using Hibernate. Which works just fine.</p>
  
  <pre><code>public class Patient implements Serializable {
  
      private int    patientId;
      private String firstName;
      private String lastName;
      private Set&lt;Prescription&gt; patientPrescriptions;
  
      public Patient() {}
  
      ...
  }
  </code></pre>
  
  <p>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:</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>I suppose this is due to the fact it cannot serialize <strong>Set</strong> 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?</p>
  
  <p>Thank you.</p>