Basically I want to execute this query
set public.ownerId = 'Owner-3';
I have tried this in JPA, but no luck. Getting unexpected token set error .
@Modifying
@Query(value = "set public.ownerId = :ownerId;")
public void setGlobalVariableOwnerId(String ownerId);
Error:
2021-03-31 10:19:07.243 ERROR 1 --- [ main] o.h.hql.internal.ast.ErrorTracker : line 1:1: unexpected token: set
2021-03-31 10:19:07.245 ERROR 1 --- [ main] o.h.hql.internal.ast.ErrorTracker : line 1:1: unexpected token: set
antlr.NoViableAltException: unexpected token: set
at org.hibernate.hql.internal.antlr.HqlBaseParser.statement(HqlBaseParser.java:212) ~[hibernate-core-5.4.27.Final.jar!/:5.4.27.Final]
If I hardcode the value instead of parameter like this set public.ownerId = 'Owner-3' .It works.
Please help Thanks in advance
@Query(value = "set public.ownerId = ?1")