- All Implemented Interfaces:
public class PostgreSQLCallableStatementSupport extends AbstractStandardCallableStatementSupportPostgreSQL implementation of CallableStatementSupport.
Until version 11, stored procedures weren't supported in PostgreSQL, but the JDBC driver allowed calling functions with the JDBC call syntax by translating to select statements. Unfortunately, the JDBC driver can't differentiate between functions and stored procedures and calling functions is not allowed with the PostgreSQL 11+ native 'call xxx' syntax. This is why the driver introduced a config property 'escapeSyntaxCallMode' that has the options 'callIfNoReturn', 'call' and 'select' (default).
For more details, see the driver documentation.
Since Hibernate knows if it is being asked to invoke a function or real procedure, the following implementation tries to be agnostic of the driver setting by using the native syntax where possible.
When a stored procedure is marked as function, it will use the
PostgreSQLCallableStatementSupport.CallMode.FUNCTIONsyntax, unless the return type is a REF_CURSOR, in which case it will use the
PostgreSQLCallableStatementSupport.CallMode.TABLE_FUNCTIONsyntax. For PostgreSQL 11+, it will always use the
PostgreSQLCallableStatementSupport.CallMode.NATIVE_CALLsyntax when a procedure is not marked as function. If the first parameter is a REF_CURSOR it will use the
PostgreSQLCallableStatementSupport.CallMode.CALL_RETURNsyntax for PostgreSQL before 11, but also if this is a function and the return type is a REF_CURSOR. In all other cases, it will use the JDBC escape
Even though the rendered callable is different, the behavior should match that of previous Hibernate versions, yet this should work regardless of the configured 'escapeSyntaxCallMode'.
All Methods Instance Methods Concrete Methods Modifier and Type Method Description
Methods inherited from class org.hibernate.procedure.internal.AbstractStandardCallableStatementSupport