我在表中有一个java.util.timestamp列´我无法与where子句中的变量进行比较。使用此代码:
// Using Calendar to convert Java Date 'horarioEliminar' to Sql Timestamp 't'
Calendar cal = Calendar.getInstance();
cal.setTime(horarioEliminar);
cal.set(Calendar.MILLISECOND, 0);
Timestamp t = new java.sql.Timestamp(cal.getTimeInMillis());
String horQ = "FROM Academia.Horarios WHERE horario ="+ t;
horario = (Horarios) session.createQuery(horQ).uniqueResult();
我有个例外:
错误[http-nio-8080-exec-873]org.hibernate.hql.internal.ast.errorcounter.reporterror行1:57:意外标记:10
但我检查了system.out.println(t)结果是否与horario列中存储的值匹配。如何正确比较这两个时间戳?
1条答案
按热度按时间mkh04yzy1#
尝试将时间戳设置为如下查询参数: