title: @NamedStoredProcedureQuery with Spring Data JPA Repository - Type cannot be null error
body: <p>I have a JPA Entity class RequestSummary which originally was being populated from a database view. I'm trying to refactor this to use a stored procedure for performance reasons but am having issues getting it set up correctly.</p>
  
  <p>I have a stored procedure 'sp_bsc_request_summary' which takes a staffId as a parameter.</p>
  
  <p>My spring data repository looks like this</p>
  
  <pre><code>public interface RequestSummaryRepository extends JpaRepository&lt;RequestSummary, Long&gt; {
  
  @Procedure("procedureFindAll")
  public List&lt;RequestSummary&gt; procedureFindAll(@Param("staffId") Long staffId);
  }
  </code></pre>
  
  <p>My JPA Entity looks like this...</p>
  
  <pre><code>@Entity
  @Table(name = "vw_bsc_request_summary")
  @NamedStoredProcedureQuery(
      name = "procedureFindAll", 
      procedureName = "sp_bsc_request_summary", 
      resultClasses = {RequestSummary.class}, 
      parameters = {@StoredProcedureParameter(mode = ParameterMode.IN, type = Long.class, name = "staffId")})
  
  public class RequestSummary {
  
      @Id
      @Column(name = "bsc_request_id")
      private Long id;
      ....etc 
  </code></pre>
  
  <p>So there are a few things I'm not sure of</p>
  
  <ul>
  <li>The entity is no longer backed by the 'vw_bsc_request_summary', so do I completely remove the @Table annotation? If I do then JPA complains about not being able to find a table with the default name RequestSummary</li>
  <li>Should I be including the @Entity annotation if this entity is not backed by a table or view?</li>
  </ul>
  
  <p>With the code above, when I try and run an integration test to call the method</p>
  
  <pre><code>@Test
  public void testFindAll() {
      final List&lt;RequestSummary&gt; requests = this.summaryRepo.procedureFindAll(61953104L);
      Assert.assertNotNull(requests);
      Assert.assertTrue(requests.size() &gt; 0);
  }
  </code></pre>
  
  <p>Then I get a stacktrace complaining about a null HibernateType</p>
  
  <pre><code>org.springframework.dao.InvalidDataAccessApiUsageException: Type cannot be null; nested exception is java.lang.IllegalArgumentException: Type cannot be null
      at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:381)
      at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:157)
      at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:417)
      at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:59)
      at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213)
      at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:147)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodIntercceptor.invoke(CrudMethodMetadataPostProcessor.java:122)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
      at com.sun.proxy.$Proxy54.procedureFindAll(Unknown Source)
      at com.hsbc.gbgcf.bsc.repository.RequestRepositoryIntegrationTest.testFindAll(RequestRepositoryIntegrationTest.java:111)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
      at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
      at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
      at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
      at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)
      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
      at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
      at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
  Caused by: java.lang.IllegalArgumentException: Type cannot be null
      at org.hibernate.procedure.internal.AbstractParameterRegistrationImpl.setHibernateType(AbstractParameterRegistrationImpl.java:182)
      at org.hibernate.procedure.internal.AbstractParameterRegistrationImpl.&lt;init&gt;(AbstractParameterRegistrationImpl.java:131)
      at org.hibernate.procedure.internal.AbstractParameterRegistrationImpl.&lt;init&gt;(AbstractParameterRegistrationImpl.java:140)
      at org.hibernate.procedure.internal.AbstractParameterRegistrationImpl.&lt;init&gt;(AbstractParameterRegistrationImpl.java:97)
      at org.hibernate.procedure.internal.NamedParameterRegistration.&lt;init&gt;(NamedParameterRegistration.java:41)
      at org.hibernate.procedure.internal.ProcedureCallImpl.registerParameter(ProcedureCallImpl.java:344)
      at org.hibernate.jpa.internal.StoredProcedureQueryImpl.registerStoredProcedureParameter(StoredProcedureQueryImpl.java:152)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.springframework.orm.jpa.SharedEntityManagerCreator$DeferredQueryInvocationHandler.invoke(SharedEntityManagerCreator.java:362)
      at com.sun.proxy.$Proxy68.registerStoredProcedureParameter(Unknown Source)
      at org.springframework.data.jpa.repository.query.StoredProcedureJpaQuery.newAdhocStoredProcedureQuery(StoredProcedureJpaQuery.java:175)
      at org.springframework.data.jpa.repository.query.StoredProcedureJpaQuery.createStoredProcedure(StoredProcedureJpaQuery.java:130)
      at org.springframework.data.jpa.repository.query.StoredProcedureJpaQuery.doCreateQuery(StoredProcedureJpaQuery.java:89)
      at org.springframework.data.jpa.repository.query.StoredProcedureJpaQuery.createQuery(StoredProcedureJpaQuery.java:80)
      at org.springframework.data.jpa.repository.query.JpaQueryExecution$ProcedureExecution.doExecute(JpaQueryExecution.java:298)
      at org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution.java:77)
      at org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:100)
      at org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:91)
      at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:393)
      at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:371)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)
      at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)
      at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
      ... 37 more
  </code></pre>
  
  <p>I've looked at numerous other posts and at the Spring.io documentation but I'm still struggling to resolve this.</p>
  
  <p>Any ideas?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>So following suggestions from <strong>lanemax</strong>...my service method looks like this:</p>
  
  <pre><code>public List&lt;RequestSummary&gt; findAll(final Long staffId) {
      final StoredProcedureQuery storedProcedureQuery = this.entityManager.createNamedStoredProcedureQuery("procedureFindAll");
      storedProcedureQuery.setParameter("staffId", staffId);
      storedProcedureQuery.execute();
      return storedProcedureQuery.getResultList();
  }
  </code></pre>
  
  <p>and my entity class like this</p>
  
  <pre><code>@NamedStoredProcedureQuery(name = "procedureFindAll", procedureName = "sp_bsc_request_summary", parameters = {
  @StoredProcedureParameter(mode = ParameterMode.IN, type = Long.class, name = "staffId")}, resultSetMappings = "mapping")
  
  @SqlResultSetMapping(name = "mapping", classes = {@ConstructorResult(targetClass = RequestSummary.class, columns = {
  @ColumnResult(name = "bsc_request_id", type = Long.class), @ColumnResult(name = "created_date", type = Date.class),
  @ColumnResult(name = "transaction_size", type = BigDecimal.class),
  @ColumnResult(name = "approval_status_id", type = Long.class),
  @ColumnResult(name = "approval_status_desc", type = String.class), @ColumnResult(name = "approval_key", type = String.class),
  @ColumnResult(name = "captain_staff_id", type = Long.class), @ColumnResult(name = "captain_name", type = String.class),
  @ColumnResult(name = "captain_country_id", type = Long.class), @ColumnResult(name = "captain_country", type = String.class),
  @ColumnResult(name = "est_fee_usd", type = BigDecimal.class), @ColumnResult(name = "client_vision_id", type = String.class),
  @ColumnResult(name = "client_full_name", type = String.class), @ColumnResult(name = "client_country_id", type = Long.class),
  @ColumnResult(name = "country_description", type = String.class), @ColumnResult(name = "mastergroup", type = String.class),
  @ColumnResult(name = "decision_staff_id", type = Long.class), @ColumnResult(name = "decision_staff_name", type = String.class),
  @ColumnResult(name = "temporary_client_name", type = String.class)
  
  })})
  @Entity
  public class RequestSummary {
  
  @Id
  private Long id;
  </code></pre>
  
  <p>When I call the method though I get a stack-trace as below</p>
  
  <pre><code>2016-12-16 10:58:10,565 ERROR [http-bio-8080-exec-28] controller.RequestController - Current CallableStatement ou was not a ResultSet, but getResultList was called
  java.lang.IllegalStateException: Current CallableStatement ou was not a ResultSet, but getResultList was called
  at org.hibernate.jpa.internal.StoredProcedureQueryImpl.getResultList(StoredProcedureQueryImpl.java:336)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.springframework.orm.jpa.SharedEntityManagerCreator$DeferredQueryInvocationHandler.invoke(SharedEntityManagerCreator.java:362)
  at com.sun.proxy.$Proxy82.getResultList(Unknown Source)
  at com.company.gbgcf.bsc.service.RequestService.findAll(RequestService.java:112)
  at com.company.gbgcf.bsc.service.RequestService.findAll(RequestService.java:125)
  at com.company.gbgcf.bsc.controller.RequestController.findAllRequests(RequestController.java:102)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
  at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
  at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:747)
  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:676)
  at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
  at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
  at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
  at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:369)
  at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
  at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
  at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
  at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
  at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
  at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
  at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
  at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
  at org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:91)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
  at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
  at com.company.gbgcf.bsc.filters.AuthenticatedSessionFilter.doFilter(AuthenticatedSessionFilter.java:143)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
  at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
  at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
  at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:168)
  at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
  at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
  at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:947)
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
  at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1009)
  at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
  at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
  at java.lang.Thread.run(Thread.java:724)
  </code></pre>
  
  <p>Initially I thought this might be because the procedure was printing out some debug info as well asthe recordset, however having removed these print statements I am still getting the same error.....</p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>Adding a bit more logging confirms that the correct procedure is called and the parameter is bound...</p>
  
  <pre><code>    2016-12-16 11:54:53,883 DEBUG [http-bio-8080-exec-25] spi.SqlStatementLogger - 
      {call sp_bsc_request_summary(?)}
      Hibernate: 
      {call sp_bsc_request_summary(?)}
      2016-12-16 11:54:53,904 TRACE [http-bio-8080-exec-25] sql.BasicBinder - binding parameter [1] as [BIGINT] - [61953104]
  2016-12-16 11:54:53,984 DEBUG [http-bio-8080-exec-1] annotation.AbstractMessageConverterMethodProcessor - Written [{"forename":"CRAIG","surname":"GORDON","roleNames":["DP_DEFAULT_VIEW_LAF","DP_MENU_DELETE","GB_ADVISORY_DEAL_STATUS_UPDATE_REPORT_USER","DP_ADD_NEW_DEAL","DP_CF_Report","GB_CAPITAL_FINANCING_REPORT","LAF_MD_PIPELINE_REPORT_USER","LAF_CANNED_REPORT","DCM_DEAL_PIPELINE_USER","DP_DEAL_PIPELINE_USER","GB_ADVISORY_NEW_DEALS_REPORT_USER","LAF_DEAL_CLOSE_REPORT","DP_SHOW_CLIENT_ON_REPORTS","DCM_CAPITAL_FINANCING_REPORT","LAF_DEAL_PIPELINE_USER","GB_CANNED_REPORT","DP_EXT_Deal_Access_DCM","GB_DEAL_PIPELINE_USER","Clone_GB_Deal","DP_EXT_Deal_Access_MnA"]}] as "application/json;charset=UTF-8" using [org.springframework.http.converter.StringHttpMessageConverter@d3d0bbc]
  2016-12-16 11:54:53,986 DEBUG [http-bio-8080-exec-1] servlet.DispatcherServlet - Null ModelAndView returned to DispatcherServlet with name 'bsc': assuming HandlerAdapter completed request handling
  2016-12-16 11:54:53,986 DEBUG [http-bio-8080-exec-1] servlet.FrameworkServlet - Successfully completed request
  2016-12-16 11:54:53,988 DEBUG [http-bio-8080-exec-1] access.ExceptionTranslationFilter - Chain processed normally
  2016-12-16 11:54:53,988 DEBUG [http-bio-8080-exec-1] context.SecurityContextPersistenceFilter - SecurityContextHolder now cleared, as request processing completed
  Building Return [isResultSet=false, updateCount=0, extendedReturn=false
  2016-12-16 11:54:54,597 DEBUG [http-bio-8080-exec-25] jpa.EntityManagerFactoryUtils - Closing JPA EntityManager
  2016-12-16 11:54:54,617 ERROR [http-bio-8080-exec-25] controller.RequestController - Current CallableStatement ou was not a ResultSet, but getResultList was called
  java.lang.IllegalStateException: Current CallableStatement ou was not a ResultSet, but getResultList was called
      at org.hibernate.jpa.internal.StoredProcedureQueryImpl.getResultList(StoredProcedureQueryImpl.java:336)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  </code></pre>
  
  <p><strong>UPDATE 3</strong></p>
  
  <p>Finally got this working. So for anyone else experiencing issues....
  The error - <code>Current CallableStatement ou was not a ResultSet</code>
  was resolved by including <code>set nocount on</code> in my stored procedure (this is in sybase 15)
  This then left me with another error where the @ConstructorResult could not locate the correct constructor. This was because some of the data types inferred from the fields returned from the procedure did not macth with those expected by the constructor. Identifying the culprits involved downloading the hibernate source jar and putting a breakpoint on </p>
  
  <pre><code>ConstructorResultColumnProcessor.resolveConstructor(Class targetClass, List&lt;Type&gt; types)
  </code></pre>
  
  <p>Once the types were aligned it all worked as expected.</p>