Allow me to be more specific.
I am using a query similar to this:
<select id="getPeople" resultClass="Person">
SELECT name, city "address.city", state "address.state"
FROM PERSON
</select>
So, I guess when iBatis sees those bean property aliases, it makes a
new Address() object even if the column is null.
Is there a better way of handling this?
Thanks,
Ian.
On Jul 9, 2008, at 11:29 PM, Ian Zabel wrote:
Hello all,
I have a class with a complex property (another class). For example:
class Person {
Address address;
String name;
}
class Address {
String city;
String state;
}
The DB table `PERSON` has the following columns: `NAME`, `CITY`, and
`STATE`. If the `CITY` and `STATE` columns are null, iBatis seems to
simply instantiate a new Address() object and put it into my
Person(). Of course, all the properties of Address() are null. I'd
rather have Person.address be null.
Is there any way to make it /not /instantiate a new Address() object
when the `CITY` and `STATE` columns are null?
I found https://issues.apache.org/jira/browse/IBATIS-375 which
sounds similar, but after reviewing the code change in that patch, I
believe it will only fix nested ResultMaps. I don't think a nested
ResultMap is what I'm looking for here. Of course, I'm brand new to
iBatis, so, really, what do I know? ;)
Thanks!
Ian.