Hello,
I can't get hibernate to call a sybase stored procedure.
Code:
CREATE PROCEDURE store_Proc(
@param varchar(20)
)
AS
BEGIN
DECLARE
@eventId uEventId
SELECT @eventId = 1403
SELECT @eventId as eventId
END
Code:
<sql-query name="EventDAO.storeProc" callable="true">
<![CDATA[{call store_Proc(?)}]]>
</sql-query>
Code:
Session session = getSession();
Query query = session.getNamedQuery("EventDAO.storeProc");
query.setString(0, "test");
Integer eventId = (Integer)query.uniqueResult();
Produces an error:
org.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 7726, SQLState: ZZZZZ
org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: Execute cursor 'jconnect_implicit_6' is declared on a procedure which has more than one SQL statment. For the declaration of this cursor to be legal the procedure should have a single SELECT statement clause.
I've spend a day trying putting different options into hibernate config,
modifying sql-query and stored procedure with no success at all.
Please, help!
Thanks a lot
--MG
[/quote]