Larry, thanks for the info.
On 08/10/2007, Larry Meadors <[EMAIL PROTECTED]> wrote: > > You'll need to write a custom handler. > > The reason is that since you are mapping SQL results to Java object, > iBATIS cannot know that there is no record - all it sees are the > results, not the underlying tables. > > Probably the simplest solution in this case is to do the query as you > are now, but in your DAO, look at the property in B that represents > the PK of table B - if it's null, set B to null. > > It's a one liner: > > if(b.getPK() == null) a.setB(null); > > Larry > > > On 10/8/07, Fearghal O Maolcatha <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I have a class A that may or may not contain a reference to an > associated > > class B. I'm doing a left outer join between the table being represented > by > > class A and the table being represented by class B. If there is no match > in > > the table represented by class B then Ibatis still returns a reference > to an > > instance of class B with all properties set to their defaults. I would > have > > expected the reference to be set to null. Is there a way to achieve this > > behaviour (having the reference set to null when there is no > corresponding > > instance), or do I need to write a customer handler? > > > > Regards, > > Fearghal. > > > > >
