ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Reuben Firmin" <Reuben.Fir...@Copart.Com>
Subject RE: Problem addressing list index in a parameter declaration
Date Mon, 30 Oct 2006 21:34:15 GMT
Thanks. Yeah, I updated the JIRA on this. It seems to be a bug in the logic for looking for
arrays:

http://issues.apache.org/jira/browse/IBATIS-361

This is from GenericProbe.java:

public Class getPropertyTypeForGetter(Object object, String name) {
    if (object instanceof Class) {
      return getClassPropertyTypeForGetter((Class) object, name);
    } else if (object instanceof org.w3c.dom.Document) {
      return DOM_PROBE.getPropertyTypeForGetter(object, name);
    } else if (name.indexOf('[') > -1) {
      return BEAN_PROBE.getIndexedType(object,name);
    } else {
      return BEAN_PROBE.getPropertyTypeForGetter(object, name);
    }
} 

I'm hoping that this was introduced with 2.2...I'm going to try dropping down a version to
see if that helps. 

On the more general design question, I can definitely workaround, but I was attempting to
guard against business design changes in using a list. 

Thanks
Reuben


-----Original Message-----
From: Daniel Pitts [mailto:Daniel.Pitts@cnet.com]
Sent: Monday, October 30, 2006 1:25 PM
To: user-java@ibatis.apache.org
Subject: RE: Problem addressing list index in a parameter declaration


Looks like a problem with the way ibatis handles collections. Is it
possible to iterate over the addresses, rather than manually select [0]
and [1]?
Also, might it be better design (if there is always going to be exactly
two) to have them be individual properties?  streetAddress,
apartmentAddress? I don't know your requirements, obviously, but that
might be a good work-around. 

-----Original Message-----
From: Reuben Firmin [mailto:Reuben.Firmin@Copart.Com] 
Sent: Thursday, October 26, 2006 3:59 PM
To: user-java@ibatis.apache.org
Subject: Problem addressing list index in a parameter declaration

I have the following code:


public class Buyer
{
...
    private Address mailingAddress;
 
...


public class Address
{
    private List<String> addressLine;
...
    public List<String> getAddressLine()
    {


In my insert statement, I'm addressing this as:

#mailingAddress.addressLine[0]#, #mailingAddress.addressLine[1]#,

When I start the webapp, I'm getting this exception:

[15:36:42.468] Caused by: com.ibatis.common.beans.ProbeException: There
is no READABLE property named 'addressLine[0]' in class
'com.copart.xxx.Address'
[15:36:42.468] at
com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:11
4)
[15:36:42.468] at
com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:75)
[15:36:42.468] at
com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:93)
[15:36:42.468] at
com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:63)
[15:36:42.468] at
com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:51)

What's wrong with my code?

Thanks!
Reuben

Mime
View raw message