Reputation: 1445
I wish to execute a (Postgre)SQL native query that is not a "SELECT" nor an "UPDATE" nor a "DELETE" query. It is "REFRESH MATERIALIZED VIEW view_name;" and has no result as far as I know.
What is the right way to execute such a query using JPA / JPQL ?
Execution methods on javax.persistence.Query
seem to require a result set or an update/delete count.
Upvotes: 1
Views: 234
Reputation: 1445
In the end, executeUpdate()
was the correct way to do the job.
final javax.persistence.EntityManager em;
em.createNativeQuery("REFRESH MATERIALIZED VIEW view_name;").executeUpdate();
Upvotes: 1