Hi,

yes, I assume, it may have something to do with this:

http://code.google.com/webtoolkit/doc/latest/DevGuideServerCommunication.html#DevGuideSerializableTypes

GWT assumes, your object is an Enhanced Class, because it's annotated
with @Entity. This may be a wrong assumption in this case (is it?)

So you could also try to persist the object in getUser2() with the
entity manager, then detach it, and see if that works. Would be very
interesting!

BTW, I do actually believe, that it's a good idea to have data
transfer objects - even if it's redundant work (which I generally
don't like very much), but it also makes it possible to fine-tune
what's transferred over the wire. So if you have to save on bandwidth
(I do), it's a good way to go anyway :-) It can also save you from a
lot of headache...

Chris

On Mar 2, 9:21 pm, tekbe <[email protected]> wrote:
> Thank you Chris. I copied the User entity to class User2 and removed
> all JPA 2 annotations: Without the annotations it works!
>
> in the following example getUser1(), getUser3() and getUser4() work,
> getUser2() fails...
>
> @Service("testService")
> public class TestServiceImpl implements TestService {
>
>         public User getUser1() {
>                 User u = new User();
>                 u.setGroups(new HashSet<Group>());
>                 u.setId(0);
>                 u.setPassword("pw");
>                 u.setUsername("name");
>                 return u;
>         }
>
>         public User getUser2() {
>                 return new User();
>         }
>
>         public User2 getUser3() {
>                 User2 u = new User2();
>                 u.setGroups(new HashSet<Group>());
>                 u.setId(0);
>                 u.setPassword("pw");
>                 u.setUsername("name");
>                 return u;
>         }
>
>         public User2 getUser4() {
>                 return new User2();
>         }
>
> }
>
> As a workaround I could use data transfer objects in the real
> services. Maybe it's a good idea anyway.

-- 
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