How to call a procedure in sleep mode?

The first time I try to call a procedure in sleep mode, for example -

        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 -

<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>

and I added this to the configuration file, for example -

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

But when I go to fulfill my request showing an exception -

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 the program will turn off. Here is my procedure -

 CREATE DEFINER=`root`@`%` PROCEDURE `select`(IN locationid INT)
BEGIN
    SELECT cmcustLocId, cpid FROM `custsitesettings` WHERE `CMCustLocID` = locationid;
END

What is the problem that I am not following, can someone help me.

+3
source share
1 answer

The problem is with your mapping file SpCustsitesettings.hbm.xml.

Edit

<hibernate-mapping>
.....

  <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>

to

<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" />
    <![CDATA[CALL select(:locationid)]]>
</sql-query>
0
source