Update single column in database using JPA query

How to write a JPQL query to update a single column in MySql DB :

Regular SQL update query :

Update vendor_address SET ordinal = ? WHERE ordinal = ? AND vendorId = ?

JPQL update query :

UPDATE VendorAddress va SET va.ordinal = ?1 WHERE va.ordinal = ?2 AND va.vendor.vendorId =?3

Eclipse shows following error for above JPQL update query.

Input parameters can only be used in the WHERE clause or HAVING clause of a query.

Looks like JPA specifications doesn’t allow to set input parameters in update columns.
Is there any other way to update only single DB column rather than updating the whole JPA Entity using merge() method (which also needs to fetch the Entity before updating) ?

In JPA 2.1 it should work! - http://blog.davidboman.se/2012/08/jpa-input-parameters-in-update-queries/

Since you want to update the column without updating the Domain Model (via setOrdinal(…)) and let Hibernate Dirty Checking to generate the UPDATE for you (an UPDATE with all columns) then you can use a native query. There is no need to use JPQL.

If you use setOrdinal() and merge() - since this is a detached entity (if I understood corectly) - then you can use @DynamicUpdate. By simply annotating the corresponding entity at class-level with @DynamicUpdate the generated UPDATE statement will include only the modified columns. More details and an example is here: