ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Pitts" <Daniel.Pi...@cnet.com>
Subject Table alias in results map.
Date Wed, 29 Mar 2006 19:09:59 GMT
I want to perform a query like:
<select id="getData" resultClass="map" parameterClass="string">
Select * FROM data AS `root:data` JOIN other AS `root:other` JOIN
something as `root:other:something` WHERE $where$
</select>

The tables "data", "other", and "something" may or may not have
similarly named columns.  The aliases correspond to bean's in a map.
---CODE---
Map myQuery = new HashMap();
myQuery.put("root:data" = new DataBean());
myQuery.put("root:other" = new OtherBean());
myQuery.put("root:other:something" = new SomethingBean());

sqlMap.queryForObject("getData", where, myQuery);
----------

Unfortunately, ibatis seems to look only at the column name, not the
table name.  I would use result maps, but the query is way to dynamic.

My current kludge aliases EVERY column. This works, but is a somewhat
painful hack of introspection, and may be a performance bottleneck.

Is there any way to tell ibatis to use the table names as part of the
result map?

Much thanks in advance.
Daniel.

Mime
View raw message