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