-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Problem In Hibernate Qry
PostPosted: Tue Sep 29, 2009 1:31 am 
Newbie

Joined: Tue Sep 29, 2009 12:29 am
Posts: 2
Dear all

I am new to this topic.I want to count the data from database and also fetch the corresponding value for count....

Code:
public List<PromoCountVO> countPromcoCode(Date FromDate,Date ToDate)
{
   List<PromoCountVO> list=null;
   try{
      System.out.println(FromDate+""+ToDate);
      Session session = HibernateUtil.getSession();   
      list = session.createQuery("SELECT promocode,count(*) FROM PromoCodeVO WHERE userId IN(SELECT userId FROM UserVO WHERE joinDate BETWEEN ? AND ?) GROUP BY promocode").setDate(0, FromDate).setDate(1, ToDate).list();
      System.out.println(list.size());
      return list;
      
    }
   catch(Exception e)
    {
      System.out.println("PromocodeManager ::countPromcoCode(Date) :" + e);
      e.printStackTrace();
   }
   return null;
}



Please suggestion ,thanks


Top
 Profile  
 
 Post subject: Re: Problem In Hibernate Qry
PostPosted: Tue Sep 29, 2009 3:36 am 
Beginner
Beginner

Joined: Wed Nov 19, 2008 6:39 am
Posts: 44
Location: Mumbai, India
What is your problem(exception)?

_________________
Thx,
Murugesan.
Web: http://www.murugesanpitchandi.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.