-->
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: Erros While executing stored procedure///
PostPosted: Wed Nov 09, 2005 12:46 pm 
Regular
Regular

Joined: Tue Nov 08, 2005 1:30 pm
Posts: 50
Hi
I am executing a stored procedure..I am getting these errors..help is appreciated..ANd i am sure I will assign full credit who helps me..Plz do help me..

Stored Procedure:

CREATE OR REPLACE FUNCTION BOOK2

RETURN SYS_REFCURSOR
AS
st_cursor SYS_REFCURSOR;


BEGIN

OPEN st_cursor FOR
SELECT BOOK_NAME FROM BOOK;

RETURN st_cursor;


END Book2;
/

Quote:
code:


<sql-query name="myQuery" callable="true">
<return alias="emp" class="Tut.First.Book">
<return-property name="bookname" column="BOOK_NAME" />

</return>
{ ? = call BOOK2() }
</sql-query>




Code 2:
Query sel = session.getNamedQuery("myQuery");
List list = sel.list();



Quote:
Errors...




Hibernate: { ? = call BOOK2() }
org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2150)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2026)
at org.hibernate.loader.Loader.list(Loader.java:2021)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:109)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1575)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:165)
at Tut.First.Client.main(Client.java:26)
Caused by: java.sql.SQLException: Invalid column name
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java:5971)
at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:1527)
at oracle.jdbc.driver.OracleResultSet.getLong(OracleResultSet.java:1540)
at org.hibernate.type.LongType.get(LongType.java:28)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:113)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:102)
at org.hibernate.loader.Loader.getKeyFromResultSet(Loader.java:1088)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:553)
at org.hibernate.loader.Loader.doQuery(Loader.java:689)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:223)
at org.hibernate.loader.Loader.doList(Loader.java:2147)
... 6 more
could not execute query


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 09, 2005 1:33 pm 
Senior
Senior

Joined: Mon Apr 04, 2005 8:04 am
Posts: 128
Location: Manchester, NH USA
It is failing trying to find a long (numeric) column in your SQL result. I believe you want to make sure you're at least also mapping the class's <id> property in the <return-property> elements. So that means you'll need to modify the SP to return the primary key as well.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 09, 2005 2:14 pm 
Regular
Regular

Joined: Tue Nov 08, 2005 1:30 pm
Posts: 50
Let me know how can i give you full point.. i am willing to give u full points but i am not fidning anything to give..suggest the way to give u full points.. i am new here..
Thanks


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.