ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Zabel <...@ezabel.com>
Subject Leave complex properties null when columns are null?
Date Thu, 10 Jul 2008 03:29:32 GMT
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? ;)


View raw message