I\'m using Spring MVC 4, Hibernate and PostgreSQL 9.3 and have defined function (stored procedure) inside Postgres like this:
CREATE OR REPLACE FUNCTION spa.
CREATE OR REPLACE FUNCTION your_procedure() RETURNS text AS $$ BEGIN RETURN 'Some text'; END; $$ LANGUAGE plpgsql;
val query = session.createNativeQuery("SELECT your_procedure()") query.list().map { println("NativeQuery: $it") }