You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by Samuel Coutu <Sa...@Rideau.com> on 2007/08/09 22:00:31 UTC
Lazy Loading 1:1 Null
Hi,
I load a User object from IBatis.
IBatis lazy loads the BillingAddress object property from this User.
When I directly use the properties of BillingAddress after IBatis gave
it to me, there is no problem.
But, if instead of directly using the properties, I pass
User.BillingAddress as a parameter to another method, this method
receives a Null BillingAddress object.
Ex:
When BilingAddress is not null
---------
void Method1()
{
User user = userDAO.GetUser();
Println(user.BillingAddress.Street);
// Here Billing address is not null
}
When BilingAddress is null
---------
void Method1()
{
User user = userDAO.GetUser();
PrintStreet(user.BillingAddress);
}
void PrintStreet(BillingAddress addr)
{
Println(addr.Street);
// Here 'addr' is null
}
Maybe we pass the reference of an object that is not wrapped by IBatis.
Thanks for your help.