E
E
evrikom2019-08-28 08:01:21
Java
evrikom, 2019-08-28 08:01:21

How to pass an array (or list) as a parameter to a Postgresql database function call in JPA?

Good afternoon. The postgresql database has a function that has an array of numbers as a parameter.
To call a procedure from a java application, I use the StoredProcedureQuery (JPA) interface.
I tried to pass both an array of numbers and a list, errors occurred.
I had to pass an array of numbers as a string and overload the function in the database so that it accepts varchar, with subsequent conversion to an array.
I would like not to use this crutch and call the function with an array parameter.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman, 2020-01-12
@Terran37

Use the createArrayOf of the Connection interface to convert an array to PostgreSql text before inserting.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question