try changing the snippet:
 public void destroy (NewsEntity newsEntity)
  | {
  |     em.merge (newsEntity);
  |     if( em.contains (newsEntity))
  |         logger.info ("The Entity is attached to current Persistence 
Context");
  |     else
  |         logger.error ("Entity is not attached!");
  |         /* throws exception */
  |        em.remove (newsEntity);
  | } 
to something like:
public void destroy (NewsEntity newsEntity)
  | {
  |     NewsEntity managedEntity = em.merge (newsEntity);
  | 
  |     if( em.contains (managedEntity))
  |     {
  |         logger.info ("The Entity is attached to current Persistence 
Context");
  |     }
  |     else
  |     {
  |         logger.error ("Entity is not attached!");
  |     }
  |     
  |     /* throws exception */
  |     em.remove (managedEntity);
  | } 

the problem is that you should be using the managed object returned by the 
EntityManager.merge() method.

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071009
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to