I'm updating table using jpa (native query). I want to set timeout for the update query to run. I tried using query.setHint("javax.persistence.query.timeout", timeout)
, but it doesn't work. Is there any other way to add timeout ?
Below is the code snippet:
Query q = getEntityManager().createNativeQuery("some update query");
q.setParameter("personId", 1234);
int count = q.executeUpdate();
getEntityManager().flush();
return count;