title: How to get resultset from call function with @Query in Spring Boot? postgresql
body: <p>I'll try to call function on PostgreSQL with spring repository. In this case, I'm using annotation @Query. When I run the program response is </p>
  
  <pre class="lang-none prettyprint-override"><code>2019-08-15 13:16:14.678  INFO 3160 --- [nio-8090-exec-1] c.r.controllers.MCurrencyController      : currency Id : 2
  Hibernate: select * from get_curr(2)
  2019-08-15 13:16:14.749  WARN 3160 --- [nio-8090-exec-1] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 0, SQLState: 42703
  2019-08-15 13:16:14.749 ERROR 3160 --- [nio-8090-exec-1] o.h.engine.jdbc.spi.SqlExceptionHelper   : The column name currency_id was not found in this ResultSet
  </code></pre>
  
  <p>The question is how to get the result? Because with @Query can't use @Results.</p>
  
  <p>Before I try the complex procedure. I would use a simple procedure.</p>
  
  <pre><code>public interface MCurrencyRepository extends JpaRepository&lt;MCurrency, Integer&gt; {
      List&lt;MCurrency&gt; findByCurrFlag( final String currFlag);
      @Query(nativeQuery = true, value = "select * from get_curr(2)")
      List&lt;MCurrency&gt; currencyList(@Param("currId") int currId);
  </code></pre>
  
  <p>MCurrency.class</p>
  
  <pre><code>public class MCurrency {
      @Id
      @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "m_currency_currency_id_seq")
      @Column(name = "currency_id", columnDefinition = "serial")
      private int currId;
  
      @Column(name = "currency_name")
      @NotEmpty(message = "Cuurency Name can not be empty")
      private String currName;
  
      @Column(name = "currency_alias")
      @NotNull(message = "Currency Alias can not be empty")
      private String currAlias;
  
      @Column(name = "currency_activeyn")
      @NotNull(message = "Currency Flag can not be empty")
      private String currFlag;
  
      @Column(name = "currency_userid")
      @NotNull(message = "Currency User id can not be empty")
      private int currUserId;
  
      @Column(name = "currency_lastupdate")
      @UpdateTimestamp
      private LocalDateTime currLastUpdate;
  </code></pre>
  
  <p>I hope the result is currencyId, currencyName.</p>