You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by radha rukmani <ra...@yahoo.com> on 2006/01/04 23:24:33 UTC
sql joins in ibatis
Hi
I am new to iBATIS. I was able to run the person example in the ibatis website.
For one table, the example says,
<select id="getPerson" resultClass="com.comp.app.batchProcess.Person">
SELECT
PER_ID as id,
PER_FIRST_NAME as firstName,
PER_LAST_NAME as lastName,
PER_BIRTH_DATE as birthDate,
PER_WEIGHT_KG as weightInKilograms,
PER_HEIGHT_M as heightInMeters
FROM PERSON
WHERE PER_ID=#value#
</select>
but if i want details from two tables, say person and dept table. I have two bean classes person.java and dept.java
and if i want to select like,
select per_id as id, per_first_name as firstname, dept_name as deptname from person,dept where dept_no = 2
now resultClass="com.comp.app.batchProcess.Person" and "com.comp.app.batchProcess.Dept"
how to get around this. Any help is greatly appreciated.
Thanks
---------------------------------
Yahoo! Photos
Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.