SQL Query:
update de_meta set service_lines = service_lines | 5 where de_id = 20;
This works fine from SQL console.
JPA Query:
@Modifying
@Query("update DeMetaEntity set serviceLines = serviceLines | ?2 where deId = ?1")
void addDeServiceLineMap(Integer deId, int serviceLine);
This JPA query throws error because | (bitwise OR) is not valid in JPQL. Is there any way to write equivalent JPQL for given SQL query?
I don't want to use criteria queries. As I use this at JAVA INTERFACE.
Create a native query as Alan suggested:
@Modifying
@Query("update de_meta set service_lines = service_lines | ?2 where de_id = ?1", nativeQuery=true)
void addDeServiceLineMap(Integer deId, int serviceLine);
The switch nativeQuery=true will execute the SQL query as it is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With