Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Blank column names in ArrayRecord returned from native SQL query

EclipseLink 2.3.2.

We have a native SQL query declared like this:

SELECT r.* FROM id_rec r, profile_rec p WHERE r.valid <> 'N' AND r.id = p.id AND r.id = 37

We are running it against Informix 11.7.

We have a JPA entity class that is set up to map to the columns returned by this result set.

This works fine under Hibernate.

In EclipseLink 2.3.2 (as shipped with GlassFish 3.1.2.2) we get the dreaded null primary key issue (Google for "EclipseLink null primary key" and you'll see others with the same problem).

In almost all cases, it's a column name issue or a column case issue, and I understand how that could be a cause.  But.  :-)

In this case, the ArrayRecord that comes back has blanks or nulls for the column names.  If this were a case problem, I'd expect to see column names, but in the wrong case.

Here's my transcription of the error coming back:

Exception Description: The primary key read from the row [ArrayRecord(
       => 37
       => 0
       => Schmoe, Joe
[and so on])] during the execution of the query was detected to be null.

If I'm understanding the issue right, somehow the column names are not reported to EclipseLink by the driver in such a way that EclipseLink can make any head or tail of them, and when EclipseLink gets involved it looks for a column named "id" (in our case; that's the primary key in question), and, since "id" is not contained as a column name in the list of columns that forms the keyset of the ArrayRecord I just quoted, EclipseLink concludes that the value for the "id" key is null.  (Really the "id" key isn't even present.  "37" above is in fact the value for that column.)

What is responsible for filling this ArrayRecord with blank/non-existent column names?  Is this going to be a JDBC driver problem, i.e. the driver isn't providing the labels/names properly in a "*"-style SELECT clause?

(But that can't be it, if Hibernate swallows this fine...does EclipseLink require something above and beyond whatever is returned by r.* in the query above?)

Or...?

Thanks,
Laird

--
http://about.me/lairdnelson

Back to the top