How are you getting the records to merge? Are you creating a new
record and changing values, or are you getting the records from a
previous EntityManager and then calling merge() on them? If the
former, then in normal configurations, then you might want to try out
a recent 1.1.0 or 1.0.2 snapshot; we just resolved an issue related to
that behavior this week.

-Patrick

On Jan 25, 2008 7:16 PM, Tim Watts <[EMAIL PROTECTED]> wrote:
> Hi,
>
> My OpenJPA app inserts the entity correctly the 1st time, but when it's
> updated, it tries to insert it again causing a data integrity exception. See
> the exception message below. I'm using em.merge() to do the update (as well
> as the initial add). The entity key does not change between the add and
> update.
>
> Can anyone offer some suggestions as to what would cause a situation like
> this? Anyone else run across this? How did you fix it?
>
> I'm using OpenJPA 1.0.1 with Derby 10.2.2.0 and Spring's JPA support (2.0.7)
>
> ROOT CAUSE EXCEPTION MESSAGE
> ----------------------------
> Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: The statement
> was aborted because it would have caused a duplicate key value in a unique or
> primary key constraint or unique index identified by 'SQL071203083750550'
> defined on 'CRUNCHERINFO'. {prepstmnt 18605439 INSERT INTO CruncherInfo
> (serviceURL, accessKey, adminUrl, agentId, commonName, lastRegistration,
> osname, SERVICE_VALUE, state, stateKey, CRUNCHERSTATUS_VALUE) VALUES
> (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [params=(String)
> http://dellberry.cliftonfarm.net:7302, (String) bogus-accesskey, (String)
> http://dellberry.cliftonfarm.net:6322, (String) dellberry.cliftonfarm.net,
> (String) TestName_1, (Timestamp) 2008-01-25 21:02:09.512, (String) Linux,
> (String) TESTTYPE, (String) STOPPED, (String) cruncher.state.stopped,
> (String) DEAUTHORIZED]} [code=20000, state=23505]
>
> ----------------------------
> BTW: SQL071203083750550 is:
>
> ALTER TABLE "APP"."CRUNCHERINFO" ADD CONSTRAINT "SQL071203083750550" PRIMARY
> KEY ("SERVICEURL");
>



-- 
Patrick Linskey
202 669 5907

Reply via email to