Thanks for the explanation, personally I like the property functionality actually better than the extension to <sql>. But that would raise some other issues... duplicates, namespaces....

Regards,
Sven

Nils Winkler (JIRA) wrote:

[ http://issues.apache.org/jira/browse/IBATIS-264?page=comments#action_12367195 ]
Nils Winkler commented on IBATIS-264:
-------------------------------------

I pretty much agree with your reasoning, that's why I categorized it as a minor 
improvement.

Our current use case looks like this: We're using inheritance in the conceptual 
data model to include a certain set of columns in pretty much every table, e.g. 
for auditing (last update user, last update timestamp, etc.). Because of this, 
I easily end up with the same columns from two tables in the query.

I currently add an attribute "tableAlias" in my DAO to the parameter map, which 
I then use in the sql snippet:

<sql id="inc">
   $tableAlias$name,
   $tableAlias$value,
   $tableAlias$foo,
   $tableAlias$bar
</sql>
, but this is ugly, since I have to know the table alias in the DAO, while the 
rest of the SQL is in the XML mapping file.

Another option for getting rid of our hack would be to make it possible to set 
a property in the mapping file, e.g. before including the sql snippet:

<setProperty name="tableAlias" value="a" />
<include refid="inc" />

How's about that?


Reply via email to