i use a Date type in my schema like this:
Code:
    /**
    * @hibernate.property not-null="true" update="false"
    */
   public java.util.Date getPostTime()
   {
      return postTime;
   }
   public void setPostTime(java.util.Date aPostTime)
   {
      postTime = aPostTime;
   }
and use hql like this:
Code:
   private static final String selectpostbytime = "from Post as post where post.postTime <= :end and post.postTime >= :begin ;
set the parameters like this:
Code:
   query.setTimestamp("end" , end);
   query.setTimestamp("begin" , begin);
and begin / end is java.util.Date
or like this:
Code:
   query.setCalendar("end" , end);
   query.setCalendar("begin" , begin);
and begin / end is java.util.Calendar
if my computer time now is 10:24am , everything is ok
but if my computer time now is 10:24pm , in my log shows that:
Code:
   binding '24 十一月 2003 10:36:22' to parameter: 1
   binding '01 一月 1970 08:00:00' to parameter: 2
you can see that , my time now shoud be 22:36:22 ,  but bind data is 10:36:22 , why?
now the only i can do is changeing the code like below , it will work well :
Code:
   sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
   query.setString("end" , sdf.format(end));
   query.setString("begin" , sdf.format(begin));
can i just bind java.util.Date to solve this problem???
my system time format is : HH:mm:ss