I think GWT-RPC will skip null fields when building the payload. 

But I would better ask if your JPA entity is serializable so you can share 
it between GWT and your server. JPA entities will be enhanced by the JPA 
provider and lazy fields can typically only be accessed while your 
persistence session is active. If you close your session and then send your 
data to GWT, during serialization the getter for the lazy field will be 
called and it will result in an exception (enhanced JPA class trys to load 
the lazy data upon getter call, but database session is closed already). 
Maybe you also see SerializationExceptions because your JPA entities are 
enhanced and may contain additional code / class references that are not 
serializable.

How to solve this depends on your JPA provider:
I think OpenJPA lets you detach an entity which gives you back the original 
POJO (maybe lazy fields will be null then, documentation may help to find 
out). 
For Hibernate you can use something like Gilead (only supports Hibernate) 
which does pretty much what you want (Lazy fields will become null). 
EclipseLink does static or dynamic weaving to enhance the JPA entities and 
I haven't found a way to make them serializable for GWT-RPC.

So I wouldn't choose EclipseLink if you want to avoid DTO's ;-)

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/mMM7kkD1XasJ.
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