ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "den frei" <db...@centralpets.com>
Subject accessing collection properties in javabeans
Date Tue, 25 Apr 2006 08:51:52 GMT
in my sqlmapping, the parameterClass attribute in my statement element is a javabean which
has a java.util.List as a property.  Here is an example:

public class SearchReq
{
private java.util.List cities;//list of City objects
//..getters & setters
}

public class City
{
private String id;
private String name;
//..getters & setters
}

ibatis doesn't seem to like #cities[0].id#, it bombs when i start tomcat.  It looks ok by
the documentation, so how do i get it to work?  Here is the section of the doc:

Object Graph Navigation (JavaBeans Properties, Maps, Lists)

Throughout this document you may have seen objects accessed through a special syntax that
might be familiar to anyone who has used Struts or any other JavaBeans compatible framework.
The iBATIS Data Mapper framework allows object graphs to be navigated via JavaBeans properties,
Maps (key/value) and Lists. Consider the following navigation (includes a List, a Map and
a JavaBean):

Employee emp = getSomeEmployeeFromSomewhere();
((Address) ( (Map)emp.getDepartmentList().get(3) ).get (“address”)).getCity();

This property of the employee object could be navigated in an SqlMapClient property (ResultMap,
ParameterMap etc…) as follows (given the employee object as above): “departmentList[3].address.city”

---------------------------------------------
This e-mail was sent using a CentralPets.com WebMail account
Get yours at: http://mail.centralpets.com




Mime
View raw message