Well basically i have a shared object which is persitent to Hibernate but I also want to change the serialization from server to client and i wrote the Custom serialization clases
import com.google.gwt.user.client.rpc.SerializationException;
import com.google.gwt.user.client.rpc.SerializationStreamReader;
import com.google.gwt.user.client.rpc.SerializationStreamWriter;
public static void serialize(SerializationStreamWriter writer, Object instance) throws SerializationException
public static void deserialize(SerializationStreamReader reader, Object instance) throws SerializationException
I have included the gwt.user in the WEB-INF/lib although i should not, and my jboss server still cries
ERROR: Failed to get SerializationPolicy
Have you encourted this problem, does anybody know how to fix it.. preferably without using Gilead … if there is a simpler solution with Gilead , please show me how… I do not want to access the database object from GWT client, just to use the same object which is defined in shared/ for both client and server but with different serializations..
EDIT:
And care on serialziation about the Collections
This Guy has in detail
The check is already given…
but I had solved this solution with giving the jboss server explicit the gwt.rpc poilcy to, not only to the apache client…
the damn jboss server could not find those.. so it was mainly configuration problem on the server.
I would have a look at HibernateDetachUtility. The code looks complex but all it does is scan in depth an object graph and nullifies everything that is not serializable by GWT.
I use it in my app and it works nicely (I guess you can meet troubles if you have large graphs of objects to detach). All I added was a package lookup on fieldValue to see if it is of the type of one of my model objects (which are all in the same package) to also detach the value from hibernate. Have a look at the condition on line 505-506-507 (
fieldValue.getClass().getName().contains("org.rhq")should be replaced by a condition that can match objects of your hibernate model)To invoke thie utility, just call it like this: