title: Hibernate call of a PostgreSQL stored procedure having a TIMESTAMP parameter type
body: <p>I have a <code>PostgreSQL</code> database in which I created the following stored procedure : </p>
  
  <pre><code> CREATE OR REPLACE FUNCTION saveOrUpdateTicket(param1 bytea, p_date timestamp, param3 INTEGER) RETURNS Integer AS $$
  
          DECLARE
              ....
          END;
          $$ LANGUAGE plpgsql;
  </code></pre>
  
  <p>I wanted to call this stored procedure from my Java backend using <code>StoredProcedureQuery</code> of <strong>Hibernate</strong>. Bellow the declaration :</p>
  
  <pre><code>StoredProcedureQuery storedProcedureQuery = msidEntityManager.createStoredProcedureQuery("saveOrUpdateTicket");
  
  storedProcedureQuery.registerStoredProcedureParameter(1, byte[].class, ParameterMode.IN);
  storedProcedureQuery.registerStoredProcedureParameter(2, java.util.Date.class, ParameterMode.IN);
  storedProcedureQuery.registerStoredProcedureParameter(3, Integer.class, ParameterMode.IN);
  
  storedProcedureQuery.setParameter(1, key);
  storedProcedureQuery.setParameter(2, new Date());
  storedProcedureQuery.setParameter(3, val);
  
  storedProcedureQuery.execute();
  </code></pre>
  
  <p>But when I execute my code under unit testing, I have the following error : </p>
  
  <pre><code>Hibernate: 
      {call saveOrUpdateTicket(?,?,?)}
  2016-11-24 15:23:01.987  WARN 13456 --- [           main] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 0, SQLState: 42883
  2016-11-24 15:23:01.988 ERROR 13456 --- [           main] o.h.engine.jdbc.spi.SqlExceptionHelper   : ERROR: function saveorupdateticket(bytea, unknown, integer) does not exist
    IndiceÂ : No function matches the given name and argument types. You might need to add explicit type casts.
    PositionÂ : 15
  </code></pre>
  
  <p>Why Hibernate try to call <code>saveorupdateticket(bytea, unknown, integer)</code> instead of <code>saveorupdateticket(bytea,timestamp without time zone,integer)</code> ?</p>
  
  <p><em>PS: I tested with <code>java.sql.Date</code> and <code>java.sql.TimeStamp</code> with no success !</em></p>
  
  <hr>
  
  <p>I'm using : </p>
  
  <ul>
  <li><strong>Spring boot 1.4.0.RELEASE (Hibernate 5.0.9.Final and I added hibernate-java8)</strong></li>
  <li><strong>PostgreSQL 9.4.1209.jre7</strong></li>
  </ul>
  
  <p>Thank you !</p>