IBM Support

Generating JPA query methods for queries with composite foreign keys as filter parameters will not generate input parameters.

Troubleshooting


Problem

If the user is generating JPA query methods into a JPA Manager Bean and those queries contain composite foreign key values as filter parameters the generated methods will not have input parameters.

Symptom

Example:

If the query looks like: "SELECT e FROM Employee e WHERE e.department.pk.deptName = :department_pk_deptName"

Where pk.deptName is a field in an embedded composite key class.

Then the query method will be generated as follows:

@NamedQueryTarget("getEmployeeByDepartment")
public List<Employee> getEmployeeByDepartment() {
EntityManager em = getEntityManager();
List<Employee> results = null;
try {
Query query = em.createNamedQuery("getEmployeeByDepartment");
results = (List<Employee>) query.getResultList();
} finally {
em.close();
}
return results;
}

Notice the missing input parameters in the method signature.

[{"Product":{"code":"SSRTLW","label":"Rational Application Developer for WebSphere Software"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Component":"Web Development","Platform":[{"code":"PF033","label":"Windows"},{"code":"PF016","label":"Linux"}],"Version":"7.5","Edition":"","Line of Business":{"code":"LOB77","label":"Automation Platform"}}]

Log InLog in to view more of this document

This document has the abstract of a technical article that is available to authorized users once you have logged on. Please use Log in button above to access the full document. After log in, if you do not have the right authorization for this document, there will be instructions on what to do next.

Document Information

Modified date:
16 June 2026

UID

swg21319555