#Java + MyBatis + Postgres: Passing a List or Array as a Paramete

6 messages · Page 1 of 1 (latest)

true haven
#

Hi mates!

I would like to know if someone has experience with Postgres + Java-MyBatis and passing a Java Collection or Array as a Function/Procedure parameter.

Java:

public class DelayState {
    private String codDelay;
    private String flgStatus;
}

List<DelayState> delays = new ArrayList<DelayState>();
delays.add(new DelayState(“DELAY_A”,”Y”));
delays.add(new DelayState(“DELAY_B”,”N”));
delays.add(new DelayState(“DELAY_C”,”N”));

Postgres:

CREATE TYPE TP_DELAY AS (
    COD_DELAY  VARCHAR(50),
    FLG_STATUS CHAR(1)
);

CALL SP_HANDLE_DELAYS(P_DELAYS TP_DELAY[]);

I used a List in the example but it can be an y other kind of container as long as it can hold more than one element.

clever juncoBOT
#

This post has been reserved for your question.

Hey @true haven! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

kind depot
true haven
#

Thanks! I will give it a look 😉

clever juncoBOT
# true haven Thanks! I will give it a look 😉

If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.