quality@glassfish.java.net

Re: JPA problem with NB 7.1.1 GF 3.1.2

From: Mitesh Meswani <mitesh.meswani_at_oracle.com>
Date: Fri, 02 Mar 2012 10:23:19 -0800

Hi,

GlassFish 3.1.2 has an updated version of EclipseLink. If you have
verified that that pk in db is not null and the issue only happens with
GlassFish 3.1.2, this might be an EclipseLink issue. Can you please post
this on EclipseLink user's forum (eclipselink-users_at_eclipse.org).

Thanks,
Mitesh
On 3/2/2012 9:14 AM, Michael Müller wrote:
> Hi,
>
> for a simple app I tried to use a JPA native query:
>
> public List<Category> getCategories(String languageCode){
> String sqlQuery = "select catId, isnull (ctName, catName) as
> catName from listCategory left join listCategoryTrans on catId =
> ctCategoryId and ctLanguage = ?1 order by catName;";
> return getEntityManager().createNativeQuery(sqlQuery,
> Category.class).setParameter(1, languageCode).getResultList();
> }
>
> This works perfect wit GF 3.1.1
>
> But using GF 3.1.2 I'll get an error:
>
> Caused by: Exception [EclipseLink-6044] (Eclipse Persistence Services
> - 2.3.2.v20111125-r10461):
> org.eclipse.persistence.exceptions.QueryException
> Exception Description: The primary key read from the row [ArrayRecord(
> => 6
> => Datenbanken)] during the execution of the query was detected
> to be null. Primary keys must not contain null.
> Query: ReadAllQuery(referenceClass=Category sql="select catId, isnull
> (ctName, catName) as catName from listCategory left join
> listCategoryTrans on catId = ctCategoryId and ctLanguage = ? order by
> catName;")
>
> I double-checked: There is no null value.
> The problem raised with NB 7.1.1 but I figured out, that it occurs
> only with the new version of GF. I guess, it's not an NB but GF issue.
> Any hint on that?
>
> Best,
> Michael