I'm trying to call a stored procedure in Postgres from a Hibernate mapping file. I'm using custom SQL to do this
<sql-delete>SELECT call_dataflex(('delete from infe1h where recnum='?''));</sql-delete>
The ? is being replaced with the correct value but it is telling me there is a syntax error somewhere near $1. I cannot tell what this syntax error is. I have removed the single quotes around the ? and then I get a column index out of range error.
SELECT call_dataflex('delete from infe1h where recnum=3') AS call_dataflex;
That code works in pgAdmin3, but I cannot seem to get the syntax right in the Hibernate mapping file.
If anyone has an idea of how to make this work I would greatly appreciate it. I'm just not getting back enough information from the Exceptions to tell what the syntax problem is. Or if someone knows how to generate more information that would be helpful. I have it set to show the sql in the configuration file. Which looks like this
Hibernate: SELECT call_dataflex(('delete from infe1h where recnum='?''));
This is the Exception line
10:24:29,603 WARN JDBCExceptionReporter:71 - SQL Error: 0, SQLState: null
10:24:29,606 ERROR JDBCExceptionReporter:72 - Batch entry 0 SELECT call_dataflex(('delete from infe1h where recnum='4'')) was aborted. Call getNextException to see the cause.
10:24:29,606 WARN JDBCExceptionReporter:71 - SQL Error: 0, SQLState: 42601
10:24:29,607 ERROR JDBCExceptionReporter:72 - ERROR: syntax error at or near "$1"
I think the single quotes around the Integer are the problem but I'm not sure how to solve this.
Thanks,
Aaron
|