-->
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: Problem calling stored procedure
PostPosted: Fri Jan 30, 2009 5:52 pm 
Newbie

Joined: Fri Jan 30, 2009 5:25 pm
Posts: 2
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hi, I've a problem when try to invoke a stored procedure from hibernate, and I'm unable to find the error, could some body help me?
Exist another way to invoke the same construction type of stored procedure, I mean, whit the same structure that I have?

thansk a lot.

Hibernate version:
Hibernate-Version: 3.2.5.ga

Mapping documents:

<hibernate-mapping>
<sql-query callable="false" name="getComponents">
<return alias="comp" class="com.test.plsql.domain.House1"/>

{call CR_DB.GET_HOUSE(?,?,?,?,?) }

</sql-query>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():

session.getNamedQuery(com.test.plsql.domain.House1.SELECT_HOUSES)
.setString(0, "")
.setInteger(1, 0)
.setParameter(2, OracleTypes.CURSOR)
.setParameter(3, OracleTypes.NUMBER)
.setParameter(4, OracleTypes.VARCHAR)
.setResultTransformer(Transformers.aliasToBean(com..test.plsql.domain.House1.class))
.setReadOnly(true).list();
Full stack trace of any exception that occurs:

Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2223)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:152)
at com.test.House1.FindPlsqlSome(House1.java:73)
at com.test.House1.main(House1.java:40)
Caused by: java.sql.SQLException: ORA-06550: línea 1, columna 7:
PLS-00306: número o tipos de argumentos erróneos al llamar a 'GET_HOUSE'
ORA-06550: línea 1, columna 7:
PL/SQL: Statement ignored

Name and version of the database you are using:
Oracle Express 10

The generated SQL (show_sql=true):

Hibernate: {call CR_DB.GET_HOUSE(?,?,?,?,?) }

The stored package structure:

create or replace PACKAGE CR_DB IS

TYPE TypeCursorTest IS REF CURSOR;

PROCEDURE GET_HOUSE (
P_NAME IN VARCHAR2,
P_NUMBER IN NUMBER,
P_CUR IN OUT TypeCursorTest,
P_ERROR_CODE IN OUT NUMBER,
P_ERROR_MESSAGE IN OUT VARCHAR2
);

Thanks in advance.


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 30, 2009 6:28 pm 
Regular
Regular

Joined: Tue Dec 30, 2008 8:14 pm
Posts: 50
Looks like there is a compilation error in the procedure - wrong number or types of argument.

---
please rate


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.