【发布时间】:2016-05-01 16:49:54
【问题描述】:
我对这个查询有疑问:
@Modifying
@Query("UPDATE NotificationHasUser u SET u.read=true WHERE u.pk.user = ?1")
void setNotificationsAsRead(User user);
我想为特定用户名更新所有错误的read 值(因为我必须将未读通知切换为已读)。
我什至尝试使用 1 而不是 true 但我总是收到此异常:
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read=1 where id_username='luca'' at line 1
你知道这个问题吗?
【问题讨论】:
-
启用查询日志并查看发出的查询
-
您可以发布用户实体吗?
-
我发现了错误,read 可能是 MySql 的关键字,所以如果我调用该字段 isRead 一切正常
标签: jquery mysql spring hibernate spring-data