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