#1436 - PersistenceException: Query threw SQLException:No ScalarType registered for class java.util.Arrays$ArrayList Query was:select id, name from o_customer where id = any(?)

This commit is contained in:
rob bygrave committed 2018-06-19 15:30:19 +12:00
1 parent a5a8765bd0
commit dd8607b072
3 files changed
+67 -1

No files matched your search

+45
View File
@@ -1,5 +1,7 @@
package io.ebean;
import io.ebean.annotation.ForPlatform;
import io.ebean.annotation.Platform;
import io.ebean.meta.BasicMetricVisitor;
import io.ebean.meta.MetaQueryMetric;
import org.ebeantest.LoggedSqlCollector;
@@ -8,6 +10,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tests.model.basic.ResetBasicData;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
@@ -98,6 +101,48 @@ public class DtoQueryTest extends BaseTestCase {
}
@ForPlatform(Platform.POSTGRES)
@Test
public void dto_bindList_usingPostrgesAnyWithPositionedParameter() {
ResetBasicData.reset();
List<Integer> ids = Arrays.asList(1, 2);
List<DCust> list = server().findDto(DCust.class, "select id, name from o_customer where id = any(?)")
.setParameter(1, ids)
.findList();
assertThat(list).isNotEmpty();
list = server().findDto(DCust.class, "select id, name from o_customer where id in (:idList)")
.setParameter("idList", ids)
.findList();
assertThat(list).isNotEmpty();
}
@ForPlatform(Platform.POSTGRES)
@Test
public void sql_bindListParam_usingPostrgesAnyWithPositionedParameter() {
ResetBasicData.reset();
List<Integer> ids = Arrays.asList(1, 2);
List<SqlRow> list = server().createSqlQuery("select id, name from o_customer where id = any(?)")
.setParameter(1, ids)
.findList();
assertThat(list).isNotEmpty();
list = server().createSqlQuery("select id, name from o_customer where id in (:idList)")
.setParameter("idList", ids)
.findList();
assertThat(list).isNotEmpty();
}
@Test
public void dto_queryPlanHits() {