how to call stored procure using hibernate

Posted on 2011-04-25
Last Modified: 2012-05-11
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
Question by:Sachin_Ajmani
    1 Comment
    LVL 20

    Accepted Solution


    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Suggested Solutions

    I made this because I wanted to get e-mail with a attached csv file so I'd would be able to import user input into a MS Excel template, but I also wanted to register/save all inputs from each day in a file on the server. 1st - It creates a temp C…
    In this article you will learn how to create a free basic website on Bitbucket, a git service provider. Polymer creates dynamic HTML components, which allow more flexibility than static HTML. This tutorial uses Ubuntu Linux but can also be done on W…
    The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now