how to call stored procure using hibernate

Procedure name:xydata_gespeed
    SELECT * FROM xydata xy
   WHERE xy.ObjectId = xy_objectId
  AND xy.ClientId=xy_clientId
  AND xy.GpsTime >= xy_gpstime
  AND xy.GpsTime <= xy_gpstime1
  AND xy.Speed >= xy_speed ORDER BY xy.GpsTime ASC;

Open in new window

In Entity class
@NamedNativeQuery(name = "xydatas",
resultClass = Xydata.class,
query = "{call xydata_gespeed(:objectId,:clientId,:gpsTime,:gpsTime,:speed)}",
hints = {
    @QueryHint(name = "org.hibernate.callable", value = "true")

Open in new window

In hibernate query

List list1 = getSession().getNamedQuery("xydatas").setParameter("objectId", Objectid).setParameter("clientId", Integer.valueOf(id)).setParameter("gpsTime", from).setParameter("gpsTime", to).setParameter("speed", Integer.valueOf(speed)).list();

            System.out.println("Listttt " + list1.size());

Open in new window

i am getting System.out.println("Listttt " + list1.size());

list size zero what i am doing wrong please help me
Who is Participating?
All Courses

From novice to tech pro — start learning today.