|RE: [eclipselink-users] SQL emitted by EclipseLink is searching foranobject with a null primary key|
Thanks Sebastien, I may just consider putting the patch attached to that defect in place to see if that causes a different response. Thanks for the feedback.
[mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of Sebastien Tardif
This may be solved in a more recent version. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=243947
On Behalf Of Gschwind, Doug
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.
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
Back to the top