首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Mysql >

Hibenate hql 中应用mysql函数DATE_SUB出错

2012-09-08 
Hibenate hql 中使用mysql函数DATE_SUB出错String hql Update Threads set lastPost+ author + ,

Hibenate hql 中使用mysql函数DATE_SUB出错
String hql = "Update Threads set lastPost='"+ author + "' ," + "lasttime=DATE_SUB(lasttime,INTERVAL 1 YEAR)" + " where tid="+ tid;

不知道Hql语句写错没有,执行时出错!

org.springframework.orm.hibernate3.HibernateQueryException: unexpected token: 1 near line 1, column 90 [Update com.prebbs.models.Threads set lastPost='hyy' ,lasttime=DATE_SUB(lasttime,INTERVAL 1 YEAR) where tid=48]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: unexpected token: 1 near line 1, column 90 [Update com.prebbs.models.Threads set lastPost='hyy' ,lasttime=DATE_SUB(lasttime,INTERVAL 1 YEAR) where tid=48]

热点排行