You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by "Juliano Marques (JIRA)" <ji...@apache.org> on 2014/08/28 03:10:00 UTC
[jira] [Created] (DELTASPIKE-701) Add method in EntityRepository to
merge a detached entity and remove it
Juliano Marques created DELTASPIKE-701:
------------------------------------------
Summary: Add method in EntityRepository to merge a detached entity and remove it
Key: DELTASPIKE-701
URL: https://issues.apache.org/jira/browse/DELTASPIKE-701
Project: DeltaSpike
Issue Type: Improvement
Components: Data-Module
Reporter: Juliano Marques
Priority: Minor
It will be nice if EntityRepository has a method like:
public void attachAndRemove(Entity entity) {
if (entityManager.contains(entity)) {
entityManager.remove(entity);
} else {
entityManager.remove(entityManager.merge(entity));
}
}
This method will be useful to handle "java.lang.IllegalArgumentException: Removing a detached instance" exceptions.
Workaround: Create a query delegate with this method.
http://mail-archives.apache.org/mod_mbox/deltaspike-users/201408.mbox/%3CCAAuOd%3DXhb%3D-ssdzU%3DTdxWg8d18XXC15U7EjNiGya9eEgaA%2BUpA%40mail.gmail.com%3E
--
This message was sent by Atlassian JIRA
(v6.2#6252)