Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java Open Source > Hibernate
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Hibernate section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 27th, 2006, 01:23 AM
Registered User
 
Join Date: Jul 2006
Location: Bangalore, Karnataka, India.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error while invoking stored procedure in hibernate

I am trying to insert a record in oracle database , where i have written a stored procedure.
i am calling this procedure using hibernate. here is my code.

mapping file....
<sql-query name="insertCategory" callable="true">
    <return class="CategoryBO">
    <return-property name="categoryID" column="categoryid" />
    </return>
    { ? = call insertcategory(?, ?, ?, ?, ?, ?, ?) }
</sql-query>

java code.....
     Query query = session.getNamedQuery("test.CategoryBO.insertCateg ory");
        query.setInteger(0,78); // parent cat id
        query.setString(1, "cat name"); // cat name
        query.setString(2,"cat desc"); // cat desc

        query.setInteger(3, 1); // active
        query.setDate(4, new Date());
        query.setString(5, "admin");
        query.setDate(6, new Date());

List list = query.list();

since i am not aware how to invoke <sql-insert> , i have used <sql-query>.
the table contains following fields
CATEGORYID, PARENTCATEGORYID, CATEGORYNAME, CATEGORYDESCRIPTION, ACTIVE, LASTMODIFIED, MODIFIEDBY, CREATIONDATE

where categoryid is auto generated(hence i m not passing it)
my stored procedure has no problem

here is the exception
11:52:27,780 DEBUG JDBCExceptionReporter:63 - could not execute query [{ ? = call insertcategory(?, ?, ?, ?, ?, ?, ?) }]
java.sql.SQLException: ORA-06550: line 1, column 13:
PLS-00382: expression is of wrong type
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:134)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:2 89)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol .java:1891)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TT C7Protocol.java:1093)
    at oracle.jdbc.driver.OracleStatement.executeNonQuery (OracleStatement.java:2047)
    at oracle.jdbc.driver.OracleStatement.doExecuteOther( OracleStatement.java:1940)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTi meout(OracleStatement.java:2709)
    at oracle.jdbc.driver.OraclePreparedStatement.execute Update(OraclePreparedStatement.java:589)
    at oracle.jdbc.driver.OraclePreparedStatement.execute (OraclePreparedStatement.java:656)
    at org.hibernate.dialect.Oracle9Dialect.getResultSet( Oracle9Dialect.java:278)
    at org.hibernate.jdbc.AbstractBatcher.getResultSet(Ab stractBatcher.java:146)
    at org.hibernate.loader.Loader.getResultSet(Loader.ja va:1666)
    at org.hibernate.loader.Loader.doQuery(Loader.java:66 2)
    at org.hibernate.loader.Loader.doQueryAndInitializeNo nLazyCollections(Loader.java:224)
    at org.hibernate.loader.Loader.doList(Loader.java:214 5)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(L oader.java:2029)
    at org.hibernate.loader.Loader.list(Loader.java:2024)
    at org.hibernate.loader.custom.CustomLoader.list(Cust omLoader.java:111)
    at org.hibernate.impl.SessionImpl.listCustomQuery(Ses sionImpl.java:1655)
    at org.hibernate.impl.AbstractSessionImpl.list(Abstra ctSessionImpl.java:142)
    at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl. java:164)
    at test.sample.main(sample.java:62)
11:52:27,780 WARN JDBCExceptionReporter:71 - SQL Error: 6550, SQLState: 65000
11:52:27,780 ERROR JDBCExceptionReporter:72 - ORA-06550: line 1, column 13:
PLS-00382: expression is of wrong type
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored


can anybody help me....?

Reply With Quote
  #2 (permalink)  
Old August 10th, 2006, 09:13 AM
Registered User
 
Join Date: Aug 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

HI,
I am also facing same problem. i am getting following error .
Stored Procedure Executed Started
Hibernate: {call selectPlayerMaster_SP2(?)}
org.hibernate.exception.GenericJDBCException: could not execute query
        at org.hibernate.exception.ErrorCodeConverter.handled NonSpecificExceptio
n(ErrorCodeConverter.java:92)
        at org.hibernate.exception.ErrorCodeConverter.convert (ErrorCodeConverter
.java:80)
        at org.hibernate.exception.JDBCExceptionHelper.conver t(JDBCExceptionHelp
er.java:43)
        at org.hibernate.loader.Loader.doList(Loader.java:159 6)
        at org.hibernate.loader.Loader.list(Loader.java:1577)
        at org.hibernate.loader.custom.CustomLoader.list(Cust omLoader.java:112)
        at org.hibernate.impl.SessionImpl.listCustomQuery(Ses sionImpl.java:1414)

        at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl. java:153)
        at hiberservlet.doPost(hiberservlet.java:157)
        at javax.servlet.http.HttpServlet.service(HttpServlet .java:760)
        at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
        at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(Appl
icationFilterChain.java:247)
        at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationF
ilterChain.java:193)
        at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperV
alve.java:256)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContex
t.invokeNext(StandardPipeline.java:643)
        at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.jav
a:480)
        at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)

        at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextV
alve.java:191)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContex
t.invokeNext(StandardPipeline.java:643)
        at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.jav
a:480)
        at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)

        at org.apache.catalina.core.StandardContext.invoke(St andardContext.java:
2422)
        at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.j
ava:180)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContex
t.invokeNext(StandardPipeline.java:643)
        at org.apache.catalina.valves.ErrorDispatcherValve.in voke(ErrorDispatche
rValve.java:171)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContex
t.invokeNext(StandardPipeline.java:641)
        at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.j
ava:163)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContex
t.invokeNext(StandardPipeline.java:641)
        at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.jav
a:480)
        at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)

        at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineVal
ve.java:174)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContex
t.invokeNext(StandardPipeline.java:643)
        at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.jav
a:480)
        at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)

        at org.apache.coyote.tomcat4.CoyoteAdapter.service(Co yoteAdapter.java:19
9)
        at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java
:828)
        at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.proce
ssConnection(Http11Protocol.java:700)
        at org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java
:584)
        at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadP
ool.java:683)
        at java.lang.Thread.run(Thread.java:536)
Caused by: java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00905: object SCOTT.SELECTPLAYERMASTER_SP2 is invalid
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored


        at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:134)
        at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:2 89)
        at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:582)
        at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol .java:1983)
        at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TT C7Protocol.java:114
1)
        at oracle.jdbc.driver.OracleStatement.executeNonQuery (OracleStatement.ja
va:2149)
        at oracle.jdbc.driver.OracleStatement.doExecuteOther( OracleStatement.jav
a:2032)
        at oracle.jdbc.driver.OracleStatement.doExecuteWithTi meout(OracleStateme
nt.java:2894)
        at oracle.jdbc.driver.OraclePreparedStatement.execute Update(OraclePrepar
edStatement.java:608)
        at oracle.jdbc.driver.OraclePreparedStatement.execute (OraclePreparedStat
ement.java:684)
        at org.hibernate.dialect.Oracle9Dialect.getResultSet( Oracle9Dialect.java
:309)
        at org.hibernate.jdbc.AbstractBatcher.getResultSet(Ab stractBatcher.java:
127)
        at org.hibernate.loader.Loader.getResultSet(Loader.ja va:1269)
        at org.hibernate.loader.Loader.doQuery(Loader.java:39 1)
        at org.hibernate.loader.Loader.doQueryAndInitializeNo nLazyCollections(Lo
ader.java:218)
        at org.hibernate.loader.Loader.doList(Loader.java:159 3)
        ... 36 more
Can some one help to resolve me out .

Reply With Quote
  #3 (permalink)  
Old August 10th, 2006, 10:41 PM
Registered User
 
Join Date: Jul 2006
Location: Bangalore, Karnataka, India.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

can you tell me , how did u invoke your stored procedure, what are the fields in you table? (make sure that you are not inserting null values in non-nullable fields.
Reply With Quote
  #4 (permalink)  
Old April 2nd, 2007, 04:57 AM
Registered User
 
Join Date: Apr 2007
Location: Hyderabad, A.P., India.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to gopal.knoah
Default

Hi All,

   Can AnyOne tell me how to make pojo, hbm and main method for a stored procedure. If AnyOne have its complete example please send it to me at my mailing id gopal.r@knoahindia.com

Reply With Quote
  #5 (permalink)  
Old April 25th, 2007, 03:43 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,

Quote:
quote:Originally posted by avinash_thm
 I am trying to insert a record in oracle database , where i have written a stored procedure.
i am calling this procedure using hibernate. here is my code.

mapping file....
<sql-query name="insertCategory" callable="true">
    <return class="CategoryBO">
    <return-property name="categoryID" column="categoryid" />
    </return>
    { ? = call insertcategory(?, ?, ?, ?, ?, ?, ?) }
</sql-query>

java code.....
     Query query = session.getNamedQuery("test.CategoryBO.insertCateg ory");
        query.setInteger(0,78); // parent cat id
        query.setString(1, "cat name"); // cat name
        query.setString(2,"cat desc"); // cat desc

        query.setInteger(3, 1); // active
        query.setDate(4, new Date());
        query.setString(5, "admin");
        query.setDate(6, new Date());

List list = query.list();
what i understood is the paramters are not matching you've passed 7 paramters but the query expects 8 you might be forgetting the first one which is before "=" operator. try changing it.

Regards,
Rakesh
Reply With Quote
  #6 (permalink)  
Old April 25th, 2007, 03:46 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,

Quote:
quote:Originally posted by Partha sarathi
 HI,
I am also facing same problem. i am getting following error .
Stored Procedure Executed Started
Hibernate: {call selectPlayerMaster_SP2(?)}
......
        at java.lang.Thread.run(Thread.java:536)
Caused by: java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00905: object SCOTT.SELECTPLAYERMASTER_SP2 is invalid
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

......
Can some one help to resolve me out .
i think the sql syntax is not correct if see the query "SELECTPLAYERMASTER_SP2" there is no space between SELECT AND table name.

Regards,
Rakesh
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error When Running Stored Procedure Dwizz SQL Server 2000 4 May 15th, 2007 09:07 AM
HOW TO DO STORED PROCEDURE USING HIBERNATE gopal.knoah Java Databases 0 April 2nd, 2007 04:34 AM
stored procedure error saurabh321 ASP.NET 2.0 Basics 0 December 20th, 2006 09:25 AM
Stored Procedure Error in MS Access belete Access 2 June 24th, 2004 02:05 PM
Stored procedure alter table error Justine Oracle 2 June 4th, 2004 09:51 AM



All times are GMT -4. The time now is 07:40 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.