code: protected void prepareQuery(org.hibernate.query.Query query) {
          if (cacheQueries) {
              query.setCacheable(true);
          }
          if (shouldPassReadOnlyToHibernate()) {
              query.setReadOnly(true);
          }
          SessionHolder sessionHolder = (SessionHolder) TransactionSynchronizationManager.getResource(sessionFactory);
          if (sessionHolder != null && sessionHolder.hasTimeout()) {
              query.setTimeout(sessionHolder.getTimeToLiveInSeconds());
          }
      }
docs: Prepare the given Query object, applying cache settings and/or a
  transaction timeout.
  
  @param query the Query object to prepare