ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Chien <john.ch...@ncmail.net>
Subject Array as parameter class
Date Tue, 04 Oct 2005 13:46:03 GMT
I would like to pass an array of String or a class that has an property
that is an array of String or Bean into the SqlMap query statement
as a parameter class. How can I reprsent it ?

Suppose the class is

public class Criteria {
private String[] a;
private List b; // which contains list of StringBean[]

....................................
}

public class DummyBean {
private StringBean[] c;
}

public class StringBean {
private String d;
}

and the sqlmap definition is:

<statement id="getEhsInspectorsAND" parameterClass="criteria"
resultMap="getEhsInspectorsMapAND">

SELECT
EHS_ID as id,
EHS_DUMMY as dummy
FROM ehs_table
WHERE EHS_ID = #a[0]# AND EHS_DUMMY=#b[1].c.d#
ORDER BY id

</statement>

Can I write the SqlMap in this way ? or What should I do ?

If I just pass in the String[], what can I do ?

String[] f;

<statement id="getEhsInspectorsAND" parameterClass="java.lang.String[]"
resultMap="getEhsInspectorsMapAND">

SELECT
EHS_ID as id,
FROM ehs_table
WHERE EHS_ID = #value[0]#
ORDER BY id

</statement>


Thanks,


John Chien




Mime
View raw message