ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Collin Peters" <cadio...@gmail.com>
Subject Using an array instead of a List
Date Fri, 02 Mar 2007 20:07:00 GMT
This is the same question as this post, which never got fully
answered: http://www.mail-archive.com/user-java@ibatis.apache.org/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 id="programActivityResult" class="ProgramActivity">
		<result property="programActivityID" column="programActivityID" />
		<result property="activityID" column="activityID" />

Collin Peters

View raw message