Here's one use case off the top of my head
I have a detached entity... and I'm wanting to merge it back... was it
deleted by somebody else while I was working on it (in which case I should
throw and error back to the user about somebody else changing the record)?
By default, currently, merge in such a case will add the entity back in!
2008/12/8 Markus KARG <markus.karg_at_gmx.net>
> AFAIK JPA does not contain a means of detection wheter an entity has been
> removed, but only whether an instance of an entity is present or not. Also
> I
> do not see a sense in such a detection. What shall it be good for?
>
> > -----Original Message-----
> > From: Farrukh Najmi [mailto:farrukh_at_wellfleetsoftware.com]
> > Sent: Sonntag, 7. Dezember 2008 23:14
> > To: persistence_at_glassfish.dev.java.net
> > Subject: Determining if entity has been removed
> >
> > Dear colleagues,
> >
> > How can I determine whether an entity has been removed within the
> > EntityManager?
> > More generally is there any way in the JPA API to determine status of
> > an
> > entity within
> > the EntityManager? It does not appear to be possible. If not possible,
> > is this something useful to
> > consider for future version of API?
> >
> > Thanks.
> >
> > --
> > Regards,
> > Farrukh Najmi
> >
> > Web: http://www.wellfleetsoftware.com
>
>