views:

1320

answers:

2

I need to pass an array of integers from Hibernate to PL/SQL function. The current solution is the covert the array to a comma separated string and surround it with parenthesis to use it as parameter. This is solution is outlined here.

But, this approach doesn't look like a good solution when an array of 200k elements need to be passed around.

Is there any way to pass this array using Hibernate's constructs?

Edit: I am using PostgreSQL.

A: 

You would need to create a Table Valued Parameter (TVP) type in the database. Ayende's post discusses this.

Mitch Wheat
+1  A: 

It would not be advisable to pass a 200k element array to a database function. I would think a better approach would be to insert these values as a bulk insert into a separate table, then call the function and have it reference the table.

Adam Hawkes