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