ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Parkinson" <pa...@avaning.com>
Subject A couple newbie questions
Date Wed, 05 Dec 2007 21:57:41 GMT


I'm new to iBATIS, but loving it so far - decided to go with iBATIS as
opposed to Hibernate for simplicity, and to have arguably more control
over the SQL. I have a couple questions (apologies if these are covered
in hthe FAQ, but I couldn't find):


1. I have a pretty complex join, and so am using the groupBy pattern
(whereby the ResultMap for the top level object references child
resultMaps, with groupBy, and using LEFT OUTER joins) - basically
straight from the docs. It looks something like:


<select id="Foo.select_by_id" parameterClass="string"


    f.name, f.address, f.phone,

    t.colour, t.shape, t.size

  FROM Foo f

  LEFT OUTER JOIN Bar b on f.ID = b.ID

  WHERE f.name = #value#;



This is cool - my real code has many more JOINs, but you get the idea.


The problem is, if both the Foo table *and* the Bar table contain a
column with the *same* name, then the JOIN doesn't work, even when
distinguished as f.bork and b.bork.


Is there a workaround for this? 


2. Due to the problem above, I'm running a number of select queries, and
building up the result (ie. in the example above, I'd make one query for
the Bar object(s) and then the Foo object and call foo.setBar(bar) to
build things up. 


The question - if I put this in a batch statement, can I expect a good
performance boost?


Any help or tips on how best to structure this stuff is appreciated -
I"m comfortable with Java, but not much of a SQL expert (at all).


Any help is greatly appreciated.






ps. iBATIS is great so far. :)


View raw message