-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Calling a Stored Procedure in Postgres from HBM mapping file
PostPosted: Sat Mar 29, 2008 1:22 pm 
Newbie

Joined: Wed Jul 25, 2007 6:03 pm
Posts: 1
Location: Portland, Or
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.