With all the hype around Microsoft and Apple Ads, I think this the best parody:
Friday, September 19, 2008
Best PC vs Mac Parody
Posted by Kumar at 11:59 AM 1 comments
Monday, September 15, 2008
JPA: java.lang.IllegalArgumentException: Removing a detached
One of the common issues that I end up debugging is the following exception:
java.lang.IllegalArgumentException: Removing a detached instance
When does this occur?: While removing a record.
Why does this occur?: You are trying to delete a record which is retrieved in another transaction (probably even trying to delete a record that is stored in user HTTP session).
How to fix it?: Make sure you retrieve the record in the same transaction. Sample code for the same:
public void removeOrganization(Organization org) {
if (org.getId() != null) {
org=em.find(Organization.class, org.getId());
em.remove(org);
} else {
// your error logic.
}
}
Posted by Kumar at 10:16 PM 1 comments
Subscribe to:
Posts (Atom)