File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes IllegalArgumentException: cannot remove/save a detached entity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "IllegalArgumentException: cannot remove/save a detached entity" Watch "IllegalArgumentException: cannot remove/save a detached entity" New topic
Author

IllegalArgumentException: cannot remove/save a detached entity

Prashaant Sharma
Greenhorn

Joined: May 10, 2010
Posts: 1
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

Joined: Mar 06, 2010
Posts: 7
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: IllegalArgumentException: cannot remove/save a detached entity