From 6dea4f0890d72c298d4cfe5c7e02d6c005a31a82 Mon Sep 17 00:00:00 2001 From: rob bygrave Date: Tue, 28 Apr 2020 21:24:25 +1200 Subject: [PATCH] #1996 - MySQLSyntaxErrorException when update in bulk. --- src/test/java/io/ebean/UpdateQueryTest.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/test/java/io/ebean/UpdateQueryTest.java b/src/test/java/io/ebean/UpdateQueryTest.java index fd245d493..16634359c 100644 --- a/src/test/java/io/ebean/UpdateQueryTest.java +++ b/src/test/java/io/ebean/UpdateQueryTest.java @@ -98,6 +98,27 @@ public class UpdateQueryTest extends BaseTestCase { assertSql(sql.get(0)).contains("update o_customer set status = status where id > ?"); } + @Test + public void query_asUpdate_idIn() { + + ResetBasicData.reset(); + LoggedSqlCollector.start(); + + int rows = server().find(Customer.class) + .where() + .in("id", 1000, 1001, 1002) + .asUpdate() + .setRaw("status = ?", "A") + .setLabel("asUpdateByIds") + .update(); + + List sql = LoggedSqlCollector.stop(); + assertThat(sql).hasSize(1); + assertThat(rows).isEqualTo(0); + + assertSql(sql.get(0)).contains("update o_customer set status = ? where id in (?,?,?)"); + } + @Test public void update_withTransactionBatch() {