[jboss-user] [JBoss Seam] - Re: deleted entity passed to persist

ellenzhao do-not-reply at jboss.com
Wed Aug 8 05:37:00 EDT 2007


yes, that's what I wanted to remove. I changed my code like this and it worked smoothly now:

>From the controller bean, removed the code:


  | public void removeAnItem(Item anItem){
  |   entityManager.remove(anItem);
  | }
  | 

In the entity bean ShoppingPlan, added this method:


  | public void removeAnItem(Item anItem){
  |   this.items.remove(anItem);
  | }
  | 

And in the .xhtml page, call the removeAnItem(item) method from the entity bean instead of from the controller bean. Things are working, the item is removed from both the database and the web page, I'm happy.

But I'm not sure _why_ the first approach, i.e. using entityManager to remove the item always resulted in that exception....


Regards,
Ellen

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071923#4071923

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071923



More information about the jboss-user mailing list