You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by "Daniel Cunha (soro) (JIRA)" <ji...@apache.org> on 2015/06/09 14:35:01 UTC

[jira] [Updated] (DELTASPIKE-701) Add method in EntityRepository to merge a detached entity and remove it

     [ https://issues.apache.org/jira/browse/DELTASPIKE-701?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Cunha (soro) updated DELTASPIKE-701:
-------------------------------------------
    Issue Type: New Feature  (was: Improvement)

> 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: New Feature
>          Components: Data-Module
>            Reporter: Juliano Marques
>            Assignee: Daniel Cunha (soro)
>         Attachments: DELTASPIKE-701.patch
>
>
> 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.3.4#6332)