title: Hibernate - How to do @Query update with reference to @JoinColumn attribute
body: <pre><code>@Entity
  public class TransactionInfo {
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      private Long id;
      @OneToOne
      @JoinColumn(name=&quot;txnRequestId&quot;)
      private TransactionRequest txnRequest;
  
      ..
  }
  </code></pre>
  <p>I would like to do a bulk update on this table using the txnRequestId id field (which is mapped with id field of TransactionRequest table)</p>
  <p>With my limited knowledge on HQL so far, I tried this query with tr.txnRequest.id field to compare id of TransactionRequest table -</p>
  <pre><code>@Repository
  public interface TransactionInfoRepository extends JpaRepository&lt;TransactionInfo, Long&gt;, JpaSpecificationExecutor&lt;TransactionInfo&gt; {
      
  
  @Transactional
  @Modifying
  @Query(&quot;UPDATE TransactionInfo as tr SET status=?2 WHERE tr.status=?1 and tr.txnRequest.id in (?3)&quot;)
  int updateStatusToRequestedByTxnReqId(Enum.TransactionStatus oldStatus, Enum.TransactionStatus newStatus, List&lt;Long&gt; trIds);
  </code></pre>
  <p>Exception -</p>
  <pre><code>Unexpected errororg.hibernate.hql.internal.QueryExecutionRequestException: Not supported for DML operations [UPDATE com.project.model.TransactionInfo as tr SET status=?2 WHERE tr.status=?1 and tr.txnRequest.id in (?3)]; nested exception is java.lang.IllegalStateException: org.hibernate.hql.internal.QueryExecutionRequestException: Not supported for 
  DML operations [UPDATE com.project.model.TransactionInfo as tr SET status=?2 WHERE tr.status=?1 and tr.txnRequest.id in (?3)]
  org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.hql.internal.QueryExecutionRequestException: Not supported for DML operations [UPDATE com.project.model.TransactionInfo as tr SET status=?2 WHERE tr.stat
  us=?1 and tr.txnRequest.id in (?3)]; nested exception is java.lang.IllegalStateException: org.hibernate.hql.internal.QueryExecutionRequestException: Not supported for DML operations [UPDATE com.project.model.TransactionInfo as 
  tr SET status=?2 WHERE tr.status=?1 and tr.txnRequest.id in (?3)]
  </code></pre>
  <p>I also tried with tr.txnRequestId but got -</p>
  <pre><code> org.hibernate.QueryException: could not resolve property: txnRequestId of: com.project.model.TransactionInfo
  </code></pre>
  <p>I would appreciate a documentation link  or link to this chapter in Hibernate, as I could not reach upto studying these things yet and hence do not know what to search for.</p>