title: Calling an oracle function from JPA
body: <p>I am trying to call a simple function from a JPA class that returns a number based on some calculations and has the following definition.</p>
  
  <pre><code>'CREATE OR REPLACE FUNCTION CFB.FC_AMOUNT_CHECK(accountNumber IN VARCHAR2)
  return NUMBER IS .....'
  </code></pre>
  
  <p>I am trying to call this function from JPA the following way.</p>
  
  <pre><code>StringBuilder sql = new StringBuilder("call CFB.FC_AMOUNT_CHECK(:accountNumber)");
  Query query = em.createNativeQuery(sql.toString());
  query.setParameter(1, '1234');
  List&lt;?&gt; result = query.getResultList();
  </code></pre>
  
  <p>....</p>
  
  <p>However, when I execute this class, I get the below exception all the time:</p>
  
  <pre><code>java.lang.IllegalArgumentException: org.hibernate.QueryParameterException: could not locate named parameter [1]
  </code></pre>
  
  <p>I cant seem to get how JPA cannot find parameter 1....I have been breaking my head with this for the last 4 hours. Can anyone please suggest how to get the result I want?</p>