File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

IllegalArgumentException: cannot remove/save a detached entity

 
Prashaant Sharma
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have 3 entities with relationships shown below.

Entity: MyA


Entity: MyB


Entity: MyC


When removing already persisted MyA entity using below code, I am getting "java.lang.IllegalArgumentException: Removing a detached instance MyA" exception


Any help or pointers would be really helpful.
Thanks in advance
 
Tejas Morabia
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A transfer object are usually detached. And detached object cannot be removed.
So i will suggest try to use merge before removing.
Try something like this


I hope this helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic