@Query(value="select * from function()") vs SimpleJdbcCall Spring Data JDBC

43 views Asked by At

I'm trying to call function with returned data by annotation Query. And receive exception.

my function: function

I'm create interface repository implements CrudRepository<User, String>, and create a method: call function in repository

After call this method i receive exception "The result is returned when it was not expected", at the same time data was added to table.

I chose a different path and Create bean DataSource, then add method to service class where were create SimpleJdbcCall with returned value boolean add param to Map<String, Object>. After that executeFunction(Boolean.TYPE, param). As a result I recieve TRUE without any exception.

Maybe someone knows how call function with returned value from annotation @Query in this case?

a small clarification:

  • the table we are writing to has no id. Primary key is a first field whith name "one".
  • Database is PostgreSql.
  • use latest driver postrgeSql (dependency version 42.6.0)

Thanks a lot.

0

There are 0 answers