Wednesday, 7 August 2013

JPA 2 - Cannot navigate association field

JPA 2 - Cannot navigate association field

Using EclipseLink-JPA2 I'm trying to create a dynamic query. Sample code
below:
TypedQuery query = getEntityManager().createQuery("UPDATE Employee e SET
e.employeeStatus.code = :statusCode WHERE e.employeeId :employeeId",
Employee.class);
During runtime I get the following error during the execution of the above
line:
Error compiling the query invalid navigation expression
[e.employeeStatus], cannot navigate association field [employeeStatus] in
the SET clause target.
Why is this happening? If I try to update a simple column(String,int..)
not object type is executed normally. Do I have to set any property inside
my entity bean?

No comments:

Post a Comment