Jacek Laskowski wrote:
>
> On Nov 22, 2007 3:12 PM, maho77 <m.hoffmann@mvolution.de> wrote:
>
> It's a guess - shot in the dark, but worth to try out - why do you
> assign -1 to the entity primary key? 0 is the default value so
> everything that's different than the default value is likely
> considered as a valid persistent identifier.
>
> You may eventually want to run the sample with
> em.persist(em.merge(group)).
>
> Jacek
>
> --
> Jacek Laskowski
> http://www.JacekLaskowski.pl
>
>
Hi Jacek,
I have already tried em.persist(em.merge(group)). It didn't work. I the
meantime I found out that the problem obviously lies in the @TableGenerator
thing. I removed it and set the id by hand and it worked fine. So I hope
your right. with the primary key.
So only to understand it right, do I have to set the
private int id = 0;
by hand or is the attribute in the @TableGenerator enough. I ask because I
tried it with private int id; which also refused to work. On monday I will
be back in the office and try it.
Mark
--
View this message in context: http://www.nabble.com/EntityExistsException%3A-Attempt-to-persist-detached-object-tf4856534s134.html#a13901667
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
|