I am using Hibernate 3.
HualTest.hbm.xml:
Code:
<hibernate-mapping>
<class name="com.voila.unlock.VO.HualTest" table="HUAL_TEST">
<id name="id" type="long">
.....
<sql-query name="getUser" callable="true">
<return alias="emp" class="com.voila.unlock.VO.HualTest">
<return-property name="id" column="ID"/>
<return-property name="username" column="USERNAME"/>
<return-property name="userpwd" column="USERPWD"/>
</return>
{ ? = call sp_hual_get_alltest() }
</sql-query>
Java code:
Code:
Query q = session.getNamedQuery("getUser");
error:
Code:
org.hibernate.MappingException: Named query not known: getUser
at org.hibernate.impl.AbstractSessionImpl.getNamedQuery(AbstractSessionImpl.java:70)
at org.hibernate.impl.SessionImpl.getNamedQuery(SessionImpl.java:1224)
at unitTest.com.voila.hibernate.dao.HibernateOperatorTest.testQueryAllHualTest(HibernateOperatorTest.java:174)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at junit.textui.TestRunner.doRun(TestRunner.java:109)
at junit.textui.TestRunner.run(TestRunner.java:72)
at junit.textui.TestRunner.run(TestRunner.java:57)
at unitTest.com.voila.hibernate.dao.HibernateOperatorTest.main(HibernateOperatorTest.java:27)