Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [eclipselink-users] SQL emitted by EclipseLink is searching for anobject with a null primary key

This may be solved in a more recent version. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=243947


From: eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of Gschwind, Doug
Sent: Friday, February 06, 2009 4:54 PM
To: eclipselink-users@xxxxxxxxxxx
Subject: [eclipselink-users] SQL emitted by EclipseLink is searching for anobject with a null primary key

Hello everyone,

 

We are using EclipseLink 1.0.1, have set the logging level to FINER, and see that due to a call to EntityManager.flush(), EclipseLink produces a SQL statement that is attempting to find a JPA mapped object whose primary key is null, and that query is then sent to the database for execution. I wouldn’t expect that to ever happen since EclipseLink shouldn’t have to query the database in that case as no entity should exist with a null primary key.

 

Here is an example of that SQL statement. In our data model, SVCID is the primary key of the SERVICE table and does not accept null as a valid value. I should also point out that the SERVICE table houses a single table inheritance hierarchy of classes, where the discriminator column is SVCTYPE.

 

[EL Fine]: 2009.02.06 13:24:06.234--ServerSession(31822876)--Connection(29394618)--Thread(Thread[HTTPThreadGroup-5,5,HTTPThreadGroup])--SELECT SVCID, SVCTYPE, TERMNAME, TERMKEY, PROPERTIES, MATRIXSTRING, LINESTRING, CLINICALDTM, COSIGNPRVDRID, COSIGNIMPPRVDRID, COSIGNDTM, REGSERVICENODEID, TERMID, VISIBLEIND, MODELIND, ENTRYSVCACTIONCD, ENTRYPRVDRID, ENTRYIMPPRVDRID, ENTRYDTM, lineStringClobId, VISITID, patid, PARENTSVCID, PATREGIMENID, ALLERGYLISTID FROM SERVICE WHERE ((SVCID = ?) AND (SVCTYPE IN (?, ?, ?)))

      bind => [null, G, Ay, NKA]

 

Can you think of a reason why this makes sense for EclipseLink to query the database in this case? If so, that might give us a clue as to what to review in some detail.

 

Thanks,

 

Doug Gschwind





The contents of this electronic mail message and any attachments are confidential, possibly privileged and intended
for the addressee(s) only. Only the addressee(s) may read, disseminate, retain or otherwise use this message. If
received in error, please immediately inform the sender and then delete this message without disclosing its contents
to anyone.

Back to the top