>From what I know, arrays can be used with getters, by not setters. For instance, the <iterate> tag should work with arrays and Lists, but not resultMap.
Christian -----Original Message----- From: Collin Peters [mailto:[EMAIL PROTECTED] Sent: Friday, 02 March 2007 15:07 To: [email protected] Subject: Using an array instead of a List This is the same question as this post, which never got fully answered: http://www.mail-archive.com/[email protected]/msg06454.html I have a POJO which has an array of another POJO in it (N+1 style from the iBatis guide). I have gotten this to work with a java.util.List, but I need it to also work with a straight Java array. The reason for doing this is simply because I want to use the same POJO with some web services. I am using Axis2 for web services which does not support (yet) using a List, you must use an old-school array of objects. So the question is simple. Can iBatis support an array of POJO objects instead of using a List of POJO objects? I know using a List would be better, and I wish I could, but I cannot at the moment. Sample POJOs: public class ProgramVO { private Integer programID; private ProgramActivityVO[] activities; //Using an array instead of a List public Integer getProgramID() { return programID; } public void setProgramID(Integer programID) { this.programID = programID; } public ProgramActivityVO[] getActivities() { return activities; } public void setActivities(ProgramActivityVO[] activities) { this.activities = activities; } } public class ProgramActivityVO { private Integer programActivityID; private Integer activityID; public Integer getProgramActivityID() { return programActivityID; } public void setProgramActivityID(Integer programActivityID) { this.programActivityID = programActivityID; } public Integer getActivityID() { return activityID; } public void setActivityID(Integer activityID) { this.activityID = activityID; } } SQL Map: <resultMap id="programResult" class="Program" groupBy="programID"> <result property="programID"/> <result property="activities" resultMap="program.programActivityResult"/> </resultMap> <resultMap id="programActivityResult" class="ProgramActivity"> <result property="programActivityID" column="programActivityID" /> <result property="activityID" column="activityID" /> </resultMap> Regards, Collin Peters
