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) ?