想用hql查询出一个date字段的日期为今天日期的记录 hql的where子句怎么写呢
(where i.date.....)谢谢
谢谢
(where i.date.....)谢谢
谢谢
解决方案 »
- struts2整合struts1添加权限拦截--启动resin出现异常
- oracel 存储过程
- poi 3.8 导出excel 乱码
- java中用Calendar日期跨月判断怎么实现,求源码
- 各位大虾 求助啊:java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
- 求J2EE 学习资料
- Java是不是比.net还有前途?
- 在windows开发的,要连接unix下的informix!!
- Struts + Hibernate + Spring 与 Struts + EJB 有什么区别啊?!
- 关于hibernate对应试图view的问题
- hql 多表模糊查询问题
- jdbc一句String里写多个sql语句该怎么连接
String hql="select i from table i where i.date=?";
Query q=new Query(hql);
q.setDate(0,date);
java.util.Calendar date = java.util.Calendar.getInstance();
String hql="select i from table i where i.date=?";
Query q=new Query(hql);
q.setDate(0,date.getTime());
如果是这个永远查不出来,因为我不认为在查询那一时刻有数据这样java.util.Date date=new java.util.Date();
String hql="select i from table i where to_char(i.date,'yyyy-MM-dd') = to_char(?,yyyy-MM-dd)";
Query q=new Query(hql);
q.setDate(0,date);
这两个函数用于oracle,
其它数据库也有相应的函数。原理是一样的,
这种东西做多了
SimpleDataFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date = sdf.parse("2009-06-01");
List l = session.createQuery("from Person where Person.birthday:first")
.setDate("first",date).list();
where i.date = (select sysdate from dual) 如果不想要时间就转化为'yyyy-MM-dd'等你想要的格式