CREATE OR REPLACE procedure sampleproc(st_cursor OUT SYS_REFCURSOR, userid number)
AS
BEGIN
OPEN st_cursor FOR
SELECT entity_id,user_id FROM entity where user_id=userid;
END;
/
procedure created successfully.
In hbm file i have configured this.
<sql-query name="getentitydetails" callable="true">
<return class="com.EntityDetails" alias="emp">
<return-property name="entityId" column="ENTITY_ID"></return-property>
<return-property name="userID" column="USER_ID"></return-property>
</return>
{ call sampleproc1(?) }
</sql-query>
EntityDetails.java
package com;
import java.io.Serializable;
public class EntityDetails implements Serializable{
public int entityId;
public int userID;
/*public String name;
public String city;*/
/*public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}*/
public int getEntityId() {
return entityId;
}
public void setEntityId(int entityId) {
this.entityId = entityId;
}
/*public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}*/
public int getUserID() {
return userID;
}
public void setUserID(int userID) {
this.userID = userID;
}
}
when i use the following line in test client it is giving an error
SessionFactory sf1=HibernateSessionFactory.getSessionFactroy();
org.hibernate.HibernateException: Errors in named queries: com.CourseDetails.getentitydetails
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:339)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
at com.HibernateSessionFactory.getSessionFactroy(HibernateSessionFactory.java:29)
at com.SimpleTestClient.main(SimpleTestClient.java:123)
|