org.hibernate.jpa.spi.AbstractQueryImpl#setLockMode checks to see if a transaction is in progress. Really that check ought to be delayed until we actually execute the query