Hi there!
I'm trying to execute stored procedure using hibernate. But I receive exception and I can't understand why.
Please help!
Thanks in advance!
Hibernate version:
3.1.3
Mapping documents:
Code:
<hibernate-mapping>
<class name="com.softserve.biz.Task" table="task">
<id name="id" column="id" type="java.lang.Integer">
<generator class="native"/>
</id>
<many-to-one name="project" column="project_id" not-null="true" lazy="false"/>
<property name="userId" type="java.lang.Integer" column="user_id"/>
<property name="name" type="java.lang.String"/>
<property name="description" type="java.lang.String"/>
<property name="priority" type="java.lang.String"/>
<property name="state" type="java.lang.String"/>
</class>
<sql-query name="reassign" callable="true">
{ call reassign(:taskId, :toUser) }
</sql-query>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close(): session.getNamedQuery("reassign")
.setParameter("taskId", taskId)
.setParameter("toUser", user)
.list();
Full stack trace of any exception that occurs:Code:
org.hibernate.exception.GenericJDBCException: could not execute query
org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
org.hibernate.loader.Loader.doList(Loader.java:2148)
org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
org.hibernate.loader.Loader.list(Loader.java:2024)
org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:111)
org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1655)
org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:164)
com.softserve.processor.TaskProcessor.assignTask(TaskProcessor.java:149)
com.softserve.processor.TaskProcessor.doTasks(TaskProcessor.java:117)
com.softserve.web.TasksServlet.doGet(TasksServlet.java:39)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
Name and version of the database you are using:
MySQL 5