Open rumanaHaque opened 1 month ago
@rumanaHaque - The issue is fixed with the latest Eclipselink snapshot. Ref Issue 29394 Can you please check and verify at your end
I just retried this test - using this build - https://rtpgsa.ibm.com/projects/l/liberty.build/liberty/WASX.LIBERTY/daily/cl240920240821-0303.07.linux/linux/zipper/externals/installables/openliberty-24.0.0.10-beta-cl240920240821-0303.zip, but I still see the same error. Could you please provide with a link to a build that has the fix for this defect?
I did try this using one of the later drivers - which has an updated EclipseLink (5.0.0.v202408200932)version, but I still see the same error.
[INFO] [ERROR ] CWWJP0015E: An error occurred in the org.eclipse.persistence.jpa.PersistenceProvider persistence provider when it attempted to create the container entity manager factory for the PolicySAJPAOnly persistence unit. The following error occurred: Exception [EclipseLink-28018] (Eclipse Persistence Services - 5.0.0.v202408200932-f556522e743c87b8097f78cefe2b8f24f68cf79e): org.eclipse.persistence.exceptions.EntityManagerSetupException
[INFO] Exception Description: Predeployment of PersistenceUnit [PolicySAJPAOnly] failed.
[INFO] Internal Exception: Exception [EclipseLink-7158] (Eclipse Persistence Services - 5.0.0.v202408200932-f556522e743c87b8097f78cefe2b8f24f68cf79e): org.eclipse.persistence.exceptions.ValidationException
[INFO] Exception Description: Error encountered when building the @NamedQuery [GetHolderAnnuities] from entity class [class org.eclipse.persistence.internal.jpa.metadata.queries.NamedQueryMetadata].
[INFO] Internal Exception: java.lang.ClassCastException: org.eclipse.persistence.jpa.jpql.parser.NullExpression incompatible with org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable
Is this the correct EclipseLink version which has the fix for this defect?
The error for this defect I think is using the createNamedQuery - instead of using the actual query itself.
This is what I had in my original code;
factory = super.getEntityManagerFactory(holder);
em = factory.createEntityManager();
Query query = em.createNamedQuery("GetHolderAnnuities");
query.setParameter("holderId", holder.getId());
List l = (List<IAnnuity>) query.getResultList();
return l;
I modified the code - to create the Query in the code itself, instead of creating a named Query.
factory = super.getEntityManagerFactory(holder);
em = factory.createEntityManager();
Query query = em.createQuery("FROM Annuity WHERE annuityHolderId = :holderId");
query.setParameter("holderId", holder.getId());
List l = (List<IAnnuity>) query.getResultList();
return l;
This new code seems to start without any exceptions.
Describe the bug
I tried using the new way of specifying queries in JPQL. I used
Prev I had used this statement, and that worked.
<query>SELECT a FROM Annuity AS a WHERE a.annuityHolderId = :holderId</query>
Even when I tried adding SELECT this in front of the query, it still failed.
<query>SELECT this FROM Annuity WHERE annuityHolderId = :holderId</query>
If there is a stack trace, please include the FULL stack trace (without any
[internal classes]
lines in it). To find the full stack trace, you may need to check in$WLP_OUTPUT_DIR/messages.log
This is what I see in the logs:Steps to Reproduce
For a named query, use the new way of defining JPQL For e.g.
FROM Annuity WHERE annuityHolderId = :holderId
instead ofSELECT a FROM Annuity AS a WHERE a.annuityHolderId = :holderId
Expected behaviorThis new way of using JPQL should work without any issues.
Diagnostic information:
$WLP_OUTPUT_DIR/messages.log
Additional context
Here is the ffdc for the error: