我有以下 JPA 实体
@SQLDelete(sql="UPDATE service SET date_deletion = CURRENT_DATE() WHERE id = ?")
@Where(clause="date_deletion IS NULL ")
public class Service {
...
}
选择工作正常,通知没有显示 date_deletion 的所有元素,但是当我尝试删除时....
16:38:26,836 DEBUG SQL:111 - UPDATE service SET date_deletion = CURRENT_DATE() WHERE id = ?
16:38:26,836 DEBUG AbstractBatcher:418 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
16:38:26,836 DEBUG JDBCExceptionReporter:225 - could not delete: [com.foo.domain.Service#1] [UPDATE service SET date_deletion = CURRENT_DATE() WHERE id = ?]
java.sql.SQLException: Parameter index out of range (2 > number of parameters, which is 1).
SQL中有什么问题?看起来像尝试将 CURRENT_DATE() 作为参数处理并期望 2 个参数而不是 1...