Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: How to call procesure in hibenate
PostPosted: Tue Apr 17, 2012 5:58 am 
Newbie

Joined: Sat Jul 30, 2011 3:14 am
Posts: 5
First time I am trying to call procedure in hibernate like -
Code:
Session session = HibernateUtil.getFirstFactory().getCurrentSession();
        session.beginTransaction();
        Query q = getSession().getNamedQuery("select");
        q.setInteger("locationid", locId);
        cDbInsts = (List<SpCustsitesettings>) q.list();


MY hbm file SpCustsitesettings.hbm.xml is -
Code:
<hibernate-mapping>
<class name="glb.chatmeter.db.SpCustsitesettings">
    <id name="cmcustLocId" type="int">
        <column name="CMCustLocID"/>
    </id>
    <property name="cpid" type="string">
        <column name="CPID">
        </column>
    </property>
</class>
<sql-query name="select" callable="true">
    <return alias="select" class="glb.chatmeter.db.SpCustsitesettings">
        <return-property name="cmcustLocId" column="CMCustLocID" />
        <return-property name="cpid" column="CPID" />
    </return>
    <query-param name="locationid" type="int" />
{call select(:locationid)}
</sql-query>
</hibernate-mapping>


and I have added this in config file like -

Code:
<mapping resource="xml/SpCustsitesettings.hbm.xml"/>


But when I goes to execute my query showing an exception -

Code:
java.lang.StackOverflowError
    at gnu.xml.pipeline.ValidationConsumer$ChildrenRecognizer.patchNext(ValidationConsumer.java:1570)
    at gnu.xml.pipeline.ValidationConsumer$ChildrenRecognizer.patchNext(ValidationConsumer.java:1591)
    at gnu.xml.pipeline.ValidationConsumer$ChildrenRecognizer.patchNext(ValidationConsumer.java:1580)
    at gnu.xml.pipeline.ValidationConsumer$ChildrenRecognizer.patchNext(ValidationConsumer.java:1580)
    at gnu.xml.pipeline.ValidationConsumer$ChildrenRecognizer.patchNext(ValidationConsumer.java:1591)
.............................................................................


And Program going turn off.
Here is my procedure-
Code:
CREATE DEFINER=`root`@`%` PROCEDURE `select`(IN locationid INT)
BEGIN
    SELECT cmcustLocId, cpid FROM `custsitesettings` WHERE `CMCustLocID` = locationid;
   
END

What is the problem I am not following can any one help me, Thx


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

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.