Hi all,
I'd like passing an array of values to a user defined function.
I'm using:
- Postgresql 9.3
- JPA 2.0
- EntityManager.createNativeQuery()
I created my user defined function as:
Code:
CREATE OR REPLACE FUNCTION getCustomer(ids bigint[]) RETURNS SETOF bigint AS ...
Without using setParameter() following code snippet works fine :
Code:
final List<Long> customer = entityManager.createNativeQuery("SELECT getCustomer('{123, 456}')")
.getResultList();
but I'm going to use setParameter() to pass the id-array that failed:
Code:
final Long[] ids = {123L, 456L};
final List<Long> customer = entityManager.createNativeQuery("SELECT getCustomer(:ids)")
.setParameter("ids", ids )
.getResultList();
and causes following exception:
Caused by: org.postgresql.util.PSQLException: FEHLER: Funktion fnquickfilter(character varying, bytea) existiert nichtHas anybody a solution or any hint how use setParameter() in createNativeQuery()?
Thanks in advance
Jan