The problem comes from instrumentation done by the ORM. Most of the
ORM substitute the implementation of the List, Map or Set with their
own implementation since they need to track invocation of method of
the collection. I know that the latest GWT 2.0 code base is putting
code in the RPC framework to support JDO so this is probably why it is
working.
Note that relationship to the one side (for example a Customer entity)
in JPA will likely be instrumented as well.

In my project where we are using Hibernate, I have minimally enhanced
the RPC framework (ServerSerializationStreamWriter.java,
SerializabilityUtil.java) to workaround this issue.

I know other framework are trying to solve this problem but I find my
approach more efficient in term of performance even if it is less
flexible (need to be adapted for other ORM).

I suspect that it should be easy to adapt my approach for DataNucleus.

Let me know if you would like to see the coce?

On Oct 8, 7:49 pm, Dominik Steiner <dominik.j.stei...@googlemail.com>
wrote:
> Hi,
>
> I'm using JDO with App Engine and GWT and sending the domain objects
> with the JDO tags via RPC is working fine, so not sure if the problem
> is JPA?
>
> HTH
>
> Dominik
>
> On Oct 7, 3:48 am, Lubomir <lubomir.zrne...@gmail.com> wrote:
>
>
>
> > Hi, I was experimenting with it a bit as well and it seems to me that
> > even the most simple Entity bean cannot be passed through RPC call. I
> > had a simple class:
>
> > @Entity
> > public class Tournament implements Serializable {
>
> >         @Id
> >         @GeneratedValue(strategy = GenerationType.IDENTITY)
> >         private Long id;
>
> >         private int tournamentId;
>
> >         @Temporal(value = TemporalType.DATE)
> >         private Date date;
> > ...
> > and I wasnt able either to pass it from the server to the client or
> > the other way. Once I removed all the JPA annotation (no other
> > change!), everything went fine. So I think despite the fact that the
> > class above is de facto compliant with GWT requirements for via-RPC-
> > sendable classes (see the docs - serializable, fields serializable,
> > etc.), it's the JPA annotations and its processing by DataNucleus that
> > create the problem.
> > That there's some kind of problem can also be seen in the tutorial for
> > GWT and appengine: instead of much more natural approach (from certain
> > point of view) of creating the Stock entity in client code and sending
> > it through RPC, addStock is called only with String argument and Stock
> > Entity is constructed on server. Same with getStock: stock list is
> > fetched from datastore and then parsed and getStock() passes array of
> > Strings back to client, although it would be nice and convenient to
> > have Stock entity on client and populate the table by calling getters.
> > The solution is to use either DTO pattern or a 3rd party library
> > called Gilead (that does basically the same boring work of cloning
> > entity, passing it to the client and when it comes back, merging it
> > with the original)
> > LZ
>
> > On Oct 6, 11:06 pm, Sudeep S <sudee...@gmail.com> wrote:
>
> > >  Hey Benjamin,
>
> > >  Since u are using Generics ensure that all the classes Service, 
> > > ServiceAync
> > > and ServiceImpl
> > >  use the same signature i.e List<SubCatagory>  .
> > >    btw which version of gwt are u using.
>
> > >  Also, you can the temp dir where u can find a rpc.log file with the list 
> > > of
> > > all objects that are serialized.
>
> > > On Wed, Oct 7, 2009 at 2:20 AM, Benjamin <bsaut...@gmail.com> wrote:
>
> > > > I'm struggeling with this now - did you guys solve it?  I have a
> > > > simple client class that will be a parent in a simple parent-child
> > > > relationship.  If i add an ArrayList property to the parent class (i
> > > > don't even have to decorate it as persistant) i get
>
> > > > EVERE: [1254861190636000] javax.servlet.ServletContext log: Exception
> > > > while dispatching incoming RPC call
> > > > com.google.gwt.user.client.rpc.SerializationException: Type
> > > > 'org.datanucleus.sco.backed.List' 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've tried java.util.list and java.util.arraylist with same result -
> > > > defiitly not a 'org.datanucleus.sco.backed.List'
>
> > > > what's odd is that the RPC call runs in a way and the object is
> > > > persisted but without the list field.
>
> > > > Anyway - this seems like something that can't be passed in an RPC call
> > > > but i don't see why
>
> > > > @PersistenceCapable(identityType = IdentityType.APPLICATION)
> > > > public class Catagory extends BaseTreeModel implements Serializable {
>
> > > > public  Catagory() {}
>
> > > >        private static final long serialVersionUID = 1L;
> > > >       �...@primarykey
> > > >   �...@persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
> > > >   �...@extension(vendorName="datanucleus", key="gae.encoded-pk",
> > > > value="true")
> > > >        private String key;
>
> > > >         @Persistent(mappedBy = "catagory")
> > > >   private  List<SubCatagory> subcatagories;
>
> > > > }
>
> > > > On Sep 22, 5:43 am, Angel <gonzalezm.an...@gmail.com> wrote:
> > > > > i have the same problem
>
> > > > > On 5 ago, 04:52, mike <m...@introspect.com> wrote:
>
> > > > > > I have a simple one-to-many betwen two entities.  The parent entity
> > > > > > uses List to contain the child entities.  I am able to persist these
> > > > > > entities in the datastore without problems.
>
> > > > > > However, when reading a root entity at the server, I get:
>
> > > > > > rpc.SerializationException: Type 'org.datanucleus.sco.backed.List' 
> > > > > > was
> > > > > > not included in the set of types  which can be serialized...
>
> > > > > > The entities are successfully read from the datastore, but something
> > > > > > in Datanucleus doesn't build the List correctly.
>
> > > > > > Has anyone found a workaround for this serialization problem.
>
> > > > > > Thanks
>
> > > > > > GWT 1.7 GAE 1.2.2- Hide quoted text -
>
> > > > > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to