You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@deltaspike.apache.org by Juliano Marques <ju...@gmail.com> on 2014/08/19 18:00:09 UTC
ds data repository method suggestion
Hi,
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.
Regards,
*Juliano M.*
Re: ds data repository method suggestion
Posted by Thomas Andraschko <an...@gmail.com>.
Sounds good - create an feature request please.
2014-08-19 18:00 GMT+02:00 Juliano Marques <ju...@gmail.com>:
> Hi,
>
> 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.
>
> Regards,
>
> *Juliano M.*
>