I think its not a RequestFactory problem but more a JPA problem. For some 
reason EclipseLink things it has to insert the User object although it 
already exists and has an id. 

I recently had the same JPA issue (I am not using RequestFactory) and the 
problem was that the object EclipseLink wants to insert was a detached 
entity and thus not known to the current EntityManager. If you then call 
persist on the detached entity an INSERT will be done.

In your case I think you have to do something like: 

User attachedUser = entityManager.merge(booking.getUser());
booking.setUser(attachedUser); //maybe thats not needed.
entityManager.persist(booking).

That way you tell the EntityManager that the user already exists. 

A second way would be to fetch the already existing user: 

User attachedUser = entityManager.find(User.class, 
booking.getUser().getId());
booking.setUser(user); //maybe thats not needed
entityManager.persist(booking);

Hope that helps.

-- 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/-/5R1o0KHBh9oJ.
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