|Re: [eclipselink-users] SQL emitted by EclipseLink is searching for an object with a null primary key|
I'm not sure why a flush() would trigger a query at all, much less one by a null id. Could you explain what changes you have made before calling flush(), and include the full log on finest. The stack of the select would also be useful if you can get it. Gschwind, Doug wrote: > > 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(Thre > ad[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. > > > ----- --- http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland http://www.eclipse.org/eclipselink/ EclipseLink , http://www.oracle.com/technology/products/ias/toplink/ TopLink Wiki: http://wiki.eclipse.org/EclipseLink EclipseLink , http://wiki.oracle.com/page/TopLink TopLink Forums: http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , http://www.nabble.com/EclipseLink-f26430.html EclipseLink Book: http://en.wikibooks.org/wiki/Java_Persistence Java Persistence -- View this message in context: http://www.nabble.com/SQL-emitted-by-EclipseLink-is-searching-for-an-object-with-a-null-primary-key-tp21881456p21915752.html Sent from the EclipseLink - Users mailing list archive at Nabble.com.
Back to the top