-->
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.  [ 3 posts ] 
Author Message
 Post subject: Calling Sybase stored procedure from hibernate 3.1.2
PostPosted: Mon Feb 13, 2006 3:00 pm 
Beginner
Beginner

Joined: Thu Aug 04, 2005 8:41 pm
Posts: 47
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]


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 13, 2006 6:19 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
That's a problem in your proc. Looks like your server thinks you're trying to create a cursor? Is uEventId a typedef or something? It should be a type or typedef. Try something like
Code:
DECLARE @eventId int
If that works then check your definitions of uEventId.


Top
 Profile  
 
 Post subject: Calling Sybase stored procedure from hibernate 3.1.2 error
PostPosted: Tue Feb 14, 2006 9:51 pm 
Beginner
Beginner

Joined: Thu Aug 04, 2005 8:41 pm
Posts: 47
Nope this doesn't help. I do not see any problems with stored procedure
as I can call it and get result set without hibernate.

Code:
     DECLARE
     @eventId                            uEventId
     SELECT @eventId = 1403
     SELECT @eventId as eventId


Something wierd is happening in Hibernate level. If I just replace
body to this it doesn't produce the error

Code:
     SELECT 1403 as eventId


(which obviously has little value as I can't call any other stored procedure
with more than one line in it).

Has anyone had any luck calling Sybase stored procedures with
hibernate 3.1.2?

Thanks,
--MG


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

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.