Greetings GWT experts,

Sorry, it's yet another post on the topic of serializing entities
retrieved from a JPA provider.  In this case I'm using Toplink on
Glassfish which hasn't been addressed too much in these discussions
yet.

I'm retrieving an object called OperatingSystem from the JPA layer and
trying to pass it to GWT.  Toplink does bytecode instrumentation to
add a field called _toplink_flavor_vh (type
oracle.toplink.indirection.ValueHolder).  Predictably GWT barfs with:

   Caused by: com.google.gwt.user.client.rpc.SerializationException:
   Type 'oracle.toplink.essentials.indirection.ValueHolder' 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.

Theoretically I could add the source for ValueHolder as a GWT module
in order to make it serializable, but since _toplink_flavor_vh is not
really part of my bean I'd rather it be treated as transient and
skipped completely.  The compiled javascript version of my object
won't have the instrumented field on the client side anyways, so
serializing and transmitting the values of _toplink_flavor_vh over the
wire is a waste.

So here's my question.  Is there a way for me to get the field
_toplink_flavor_vh to be treated as transient when my OperatingSystem
object is serialized (remember that the source code for
OperatingSystem.java does not contain the field so I cannot add the
transient keyword; the field is added later by Toplink via bytecode
instrumentation).  Is this a scenario for a custom serializer? (a
crude hack would be to treat any field beginning with underscore as
"transient", which I think would work for all Toplink-added fields)


(Incidentally, I tried using Dozer to make a detached copy of my
object, which I think works with Hibernate, but since Toplink is
adding fields directly to my class, even a detached object created
with "new OperatingSystem()" has the TopLink field.  I've only been
able to succeed by creating separate DTO class, which I'd like to
avoid if possible.  In any case it feels redundant to make a deep
clone of my objects just before GWT-RPC does a deep serialization of
them)

Looking forward to your thoughts!
Jon

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to