Saturday, October 29, 2011

Removing entities in OneToMany with RequestFactory & JPA

I would like to know what's the right way to remove a child from a one-to-many relation within GWT using the RequestFactory.

My GWT application with an Entity called Product and that product has a one-to-many relation to an Expert:

@Entity
public class Product {
   
...
   
OneToMany(mappedBy="product", orphanRemoval=true,
              cascade
={CascadeType.DETACH,CascadeType.MERGE,CascadeType.PERSIST,CascadeType.REFRESH},fetch=FetchType.EAGER)
   
Set<Expert> experts = new HashSet<Expert>();
   
...
}

@Entity(name = "EXPERT")
public class Expert {
   
...
   
@ManyToOne(optional=false)
   
Product product;
   
...
}

I have a user-interface where you can change some values of Product, but also a window where experts can be added or removed. Adding a Expert goes well, but how do I remove an expert? And what administration must I do on the client and server side?

I have already an opened productRequest going on.

I would appreciate all the help!


--
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/-/9-I53cMhyJoJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment