-->
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: Stored procedures with hibernate
PostPosted: Mon Sep 10, 2007 9:59 am 
Newbie

Joined: Mon Jul 23, 2007 10:17 am
Posts: 12
Location: www.ultrasharpware.com
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

_________________
kodlan
http://www.UltraSharpWare.com
http://www.UltraSharpWare.com/blog


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 11, 2007 9:06 am 
Newbie

Joined: Fri Sep 07, 2007 4:16 am
Posts: 16
use formula api i think it's better.


Rate me


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.