mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1205 - ENH: Add support for raw expression array binding with Postgres - e.g. raw(" foo = any(?) ", collection)
This commit is contained in:
@@ -4,12 +4,17 @@ import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.Expr;
|
||||
import io.ebean.Query;
|
||||
import io.ebean.annotation.ForPlatform;
|
||||
import io.ebean.annotation.Platform;
|
||||
import org.tests.model.basic.Customer;
|
||||
import org.tests.model.basic.Order;
|
||||
import org.tests.model.basic.OrderDetail;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -45,6 +50,25 @@ public class TestWhereRawClause extends BaseTestCase {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@ForPlatform(Platform.POSTGRES)
|
||||
public void testRawPostgresArray() {
|
||||
|
||||
ResetBasicData.reset();
|
||||
|
||||
List<String> names = new ArrayList<>();
|
||||
names.add("Rob");
|
||||
names.add("Fiona");
|
||||
|
||||
List<Customer> list = Ebean.find(Customer.class)
|
||||
.where()
|
||||
.raw("name = any(?)", names)
|
||||
.findList();
|
||||
|
||||
assertThat(list).isNotEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRawWithBindParams() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user