-->
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.  [ 2 posts ] 
Author Message
 Post subject: Parameterless Stored Procedure Generates SQLException
PostPosted: Fri Oct 07, 2005 10:28 am 
Newbie

Joined: Tue Oct 04, 2005 2:48 pm
Posts: 1
Hibernate 3.0

I have the following mapping file.....


<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

<hibernate-mapping package="com.company.env.app">
<sql-query name="ARBSelect" callable="true">
<return class="ArbitrageCusip">
<return-property name="cusip" column="CUSIP"/>
<return-property name="asOf" column="ASOFDATE"/>
</return>
{ ? = call ARB_Select() }
</sql-query>

</hibernate-mapping>

for the following stored procedure
CREATE procedure [dbo].[ARB_Select]
As
select [CUSIP],
[asofdate]
from ARB
return 0
GO

with the following code between....

Query query=session.getNamedQuery("ARBSelect");
return query.list()


I get the following exception
10:24:23,561 INFO [STDOUT] Hibernate: { ? = call ARB_Select() }
10:24:23,561 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: 07000
10:24:23,561 ERROR [JDBCExceptionReporter] Parameter #1 has not been set.
10:24:23,577 INFO [STDOUT] org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:59)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:1596)
at org.hibernate.loader.Loader.list(Loader.java:1577)
at org.hibernate.loader.custom.CustomLoader.list


I would appreciate any assistance with resolving this particular issue.


Top
 Profile  
 
 Post subject: return type?
PostPosted: Fri Oct 07, 2005 11:01 am 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
H documentation
http://www.hibernate.org/hib_docs/v3/re ... l#sp_query
says that stored procedures should return cursors only, but it looks like your procedure tries to return result set AND scalar value 0.

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.