title: How to pass column name dynamically inside a @Query annotation using Spring data JPA
body: <p>I have entity like:</p>
  
  <pre><code>@Id
  @Column_name = "abc"
  int pk;
  @Column_name = "def"
  int id;
  </code></pre>
  
  <p>And I have Repository as:</p>
  
  <pre><code>interface fetchDataRepository extends jpaRepository&lt;className, int&gt; {
      @Query("Select S_Test.nextVal from dual");
      Long generateId();
  }
  </code></pre>
  
  <p>In above example S_Test is hardcoded sequence name.
  But the problem is that I want to pass sequence name dynamically as follows:</p>
  
  <pre><code>Long generateId(@Param("sequenceName") String sequenceName)
  </code></pre>
  
  <p>and use inside @Query annotation as:</p>
  
  <pre><code>@Query("Select :sequenceName.nextVal from dual");
  </code></pre>
  
  <p>Is there anyway to do that? Any suggestion would be appreciated.</p>
  
  <p>Edit: Isn't there possible to use #(#entityName). If yes, then please tell me how?</p>