users@glassfish.java.net

RE: Re: EntityExistsException

From: Markus Karg <karg_at_quipsy.de>
Date: Wed, 3 Mar 2010 08:48:04 +0100

Felipe,

 

thanks for your kind help.

 

In fact, the case seems to be more complex:

 

(1) Why does it say EntityExistsException?

 

(2) The object cannot be detached as it is created just at the same moment using the new operator.

 

Is it possible that this strange combination of errors message is created in cases em.persist() is called twice?

 

Thanks

Markus

 

From: Felipe Gaucho [mailto:fgaucho_at_gmail.com]
Sent: Mittwoch, 3. März 2010 08:12
To: users_at_glassfish.dev.java.net
Subject: Re: EntityExistsException

 

That's the exception description... Your object is detached, so you cannot call persist on it...

 

Google for detached entity jpa ...

 

* answering from a phone, that's why the short answers ;)

On 03.03.2010, at 08:09, "Markus Karg" <karg_at_quipsy.de> wrote:

        Actually I do not understand what you like to tell me… Can you please rephrase?

         

        From: Felipe Gaucho [mailto:fgaucho_at_gmail.com]
        Sent: Dienstag, 2. März 2010 17:09
        To: users_at_glassfish.dev.java.net
        Subject: Re: EntityExistsException

         

        Cannot persist detached object...
        
        On 02.03.2010, at 17:00, "Markus Karg" <karg_at_quipsy.de> wrote:

                We have some trouble with JPA 1.0 (TopLinkEssentials) in GFv2ur2: Sometimes server.log contains:

                 

                [#|2010-03-01T12:40:59.818+0100|INFO|sun-appserver9.1|javax.enterprise.system.container.ejb|_ThreadID=94;_ThreadName=p: thread-pool-1; w: 422;|

                javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: javax.persistence.EntityExistsException:

                Exception Description: Cannot persist detached object [de.quipsy.entities.appointment.Appointment_at_13ec86c].

                Class> de.quipsy.entities.appointment.Appointment Primary Key> [554]

                javax.persistence.EntityExistsException:

                Exception Description: Cannot persist detached object [de.quipsy.entities.appointment.Appointment_at_13ec86c].

                 

                This is weird! It says "EntityExistsException" (which means that the row already is found in the DB), but the cause would be "Cannot persist detached object" (which would mean that the object is NOT found in the DB AFAIK).

                 

                Can somebody explaint this *combination* of errors?

                 

                What is my fault?

                 

                Mit freundlichen Grüßen

                 

                Markus Karg

                Leiter Implementierung & Design

                 

                                                                                                                                                              

                 

                <image001.jpg>

                 

                QUIPSY QUALITY GmbH & Co. KG

                Ein Unternehmen der MES-Gruppe

                Stuttgarter Strasse 23 | D-75179 Pforzheim

                Telefon: +49(0)7231/9189-52 | Telefax: +49(0)7231/9189-59

                E-Mail: karg_at_quipsy.de | Internet: www.quipsy.de

                                                                                                                                                             

                 

                Geschäftsführer: Nils Schroeder

                Registergericht Mannheim HRA 701214 I USt-IdNr.: DE256549073

                Telefon: +49(0)7231-9189-0 | Telefax: +49(0)7231-9189-59 I E-Mail: info_at_quipsy.de

                 

                Diese E-Mail enthält persönliche, vertrauliche und vor Weitergabe geschützte Informationen und ist ausschließlich für den vorgesehenen o.g. Empfänger (Adressaten) bestimmt. Falls Sie diese E-Mail versehentlich erhalten haben und nicht der vorgesehene Empfänger sind, bitten wir Sie, die E-Mail und deren Anhänge nicht aufzubewahren, nicht zu vervielfältigen, nicht zu nutzen und nicht weiterzugeben. Bitte informieren Sie uns als Absender über diesen Zustellungsfehler und löschen Sie die E-Mail.