-->
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: Cannot run my Stored proc!
PostPosted: Fri Sep 08, 2006 7:05 am 
Beginner
Beginner

Joined: Thu Aug 04, 2005 5:06 am
Posts: 31
Location: Bedford, UK
I am simply trying to run a Stored procedure "test" from Hibernate but getting error message:

org.hibernate.exception.SQLGrammarException: could not execute query
Caused by: java.sql.SQLException: FUNCTION database.test does not exist


Hibernate version: 3.1.3

Mapping documents:

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

<class name="com.xxx.models.Sales" table="sales">
<meta attribute="class-description">
Represents a single temporary sale.
</meta>

<id name="id" type="integer" column="id">
<meta attribute="scope-set">protected</meta>
<generator class="native"/>
</id>

<property name="campaignMasterId" type="integer" not-null="true">
<meta attribute="field-description">Campaign Master id</meta>
</property>

<property name="orderId" type="string" not-null="true">
<meta attribute="field-description">Order id</meta>
</property>

<property name="saleDate" type="java.sql.Timestamp" not-null="true">
<meta attribute="field-description">Sale date</meta>
</property>

<property name="networkId" type="integer" not-null="true">
<meta attribute="field-description">Network id</meta>
</property>

<property name="resultId" type="integer" not-null="true">
<meta attribute="field-description">Result id</meta>
</property>

</class>

<sql-query name="test_SP" callable="true">
<return alias="sale" class="com.xxx.models.Sales">
<return-property name="id" column="id"/>
<return-property name="campaignMasterId" column="campaignMasterId"/>
<return-property name="orderId" column="orderId"/>
<return-property name="saleDate" column="saleDate"/>
<return-property name="networkId" column="networkId"/>
<return-property name="resultId" column="resultId"/>
</return>
{ ? = call test() }
</sql-query>

</hibernate-mapping>


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

Full stack trace of any exception that occurs:

2006-09-08 09:30:21,218 ERROR [STDERR] 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:2148)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:111)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1655)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:164)
at com.xxx.helper.SalesTempStoreManager.getDedupedSales(SalesTempStoreManager.java:113)
at com.xxx.helper.SalesPull.pull(SalesPull.java:134)
at com.xxx.servlet.actions.DataPullAction.execute(DataPullAction.java:40)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.sql.SQLException: FUNCTION database.test does not exist
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2928)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1571)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1666)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2994)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:936)
at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:773)
at com.mysql.jdbc.CallableStatement.execute(CallableStatement.java:552)
at com.mchange.v2.c3p0.impl.NewProxyCallableStatement.execute(NewProxyCallableStatement.java:2966)
at org.hibernate.dialect.MySQLDialect.getResultSet(MySQLDialect.java:316)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:146)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1666)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
... 33 more

Name and version of the database you are using: MySQL 5.0


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 08, 2006 9:58 am 
Beginner
Beginner

Joined: Thu Aug 04, 2005 5:06 am
Posts: 31
Location: Bedford, UK
Right ... angry, frustrated and yet pleased that I now have a solution.

VERY MANY THANKS to oldkeybo's response at
http://forum.hibernate.org/viewtopic.ph ... 02#2321602

? = call test() does not work for me!

call test() does work ... MySQL 5, JBOSS 4.0.4

So the documentation may need a small update to save others some time.


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.