title: Hibernate Query - timeout
body: <p>This should be an easy question.</p>
  
  <p>I am using <em>Java 8, Hibernate 3.6</em></p>
  
  <p>I have an <code>org.hibernate.Query</code> object and I am using it to call a<br>
  stored procedure. I am calling it with <code>query.executeUpdate();</code>.  </p>
  
  <p>How can I programatically set a timeout to this query?  </p>
  
  <p>So that when I call the SP and if the DB does not respond in say 1 hour,<br>
  it throws an exception of some sort on the Java side. Note that I don't<br>
  want to use some global hibernate property which would affect all my queries.   </p>
  
  <p>In fact if I wanted, I guess I would need to do what they say here, right?<br>
  I mean I would have needed to just set <code>javax.persistence.query.timeout</code><br>
  when starting the JVM, correct? But OK, that's not what I need.   </p>
  
  <p><a href="https://stackoverflow.com/questions/2101455/hibernate-set-default-query-timeout">Hibernate: set default query timeout?</a> </p>
  
  <p>Many thanks in advance.</p>