我下表有Postgre:如何在更新期間將null設置爲QueryDSL時間戳列?
CREATE TABLE user_attempts
(
id INT PRIMARY KEY NOT NULL,
username VARCHAR(50) NOT NULL,
attempts SMALLINT NOT NULL,
lastmodified TIMESTAMP,
FOREIGN KEY (username) REFERENCES users (username)
);
我想通過QueryDSL和Spring數據JDBC擴展更新lastmodified
領域如下:
template.update(userAttempts, update -> update
.set(userAttempts.attempts, (short) 0)
.set(userAttempts.lastmodified, null) // compilation error here
.where(userAttempts.username.eq(username))
.execute();
然而,似乎QueryDSL的設置方法不能接受null
,因爲它會匹配多個功能簽名。