hibernate获取数据库时间报错
错误代码:org.hibernate.QueryException:aggregatefunctionexpectedbefore(inSELECT[SELECTCURR...
错误代码:
org.hibernate.QueryException: aggregate function expected before ( in SELECT [SELECT CURRENT_TIMESTAMP() from com.pb.entity.User]
java代码:
public List getDataBaseTime(){
return this.find("SELECT CURRENT_TIMESTAMP() from User");
}
/**
* 通过hql语句查找
*/
public List<T> find(String hql){
return (List<T>)hibernateTemplate.find(hql);
} 展开
org.hibernate.QueryException: aggregate function expected before ( in SELECT [SELECT CURRENT_TIMESTAMP() from com.pb.entity.User]
java代码:
public List getDataBaseTime(){
return this.find("SELECT CURRENT_TIMESTAMP() from User");
}
/**
* 通过hql语句查找
*/
public List<T> find(String hql){
return (List<T>)hibernateTemplate.find(hql);
} 展开
2014-04-11
展开全部
映射失败 ~~
取User里面的属性,不要括号
SELECT CURRENT_TIMESTAMP from User
取User里面的属性,不要括号
SELECT CURRENT_TIMESTAMP from User
追问
谢谢,成功了,不过这个方法返回了多个结果,都是一样的时间,请问怎么返回一个结果??
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询