ibatis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Iwao AVE! (JIRA)" <ibatis-...@incubator.apache.org>
Subject [jira] Created: (IBATIS-577) Ibator: Define column list as 'sql' fragment for better reusability.
Date Sat, 24 Jan 2009 14:54:59 GMT
Ibator: Define column list as 'sql' fragment for better reusability.
--------------------------------------------------------------------

                 Key: IBATIS-577
                 URL: https://issues.apache.org/jira/browse/IBATIS-577
             Project: iBatis for Java
          Issue Type: Improvement
          Components: Tools
            Reporter: Iwao AVE!
            Priority: Minor


So, it would look like...

<sql id="ibatorgenerated_columnsWithBLOBs">
  column_a, column_b, column_c
</sql>

<select id="ibatorgenerated_selectByExample" parameterClass="xxx" resultMap="ibatorgenerated_BaseResultMap">
  select 
  <include refid="table_name.ibatorgenerated_ColumnsWithoutBLOBs" />
  from table_name
  ...

Then, when I add a new custom query, I can write as follows.

<resultMap id="custom_resultMap" ...>
  <result property="table_name" resultMap="table_name.ibatorgenerated_BaseResultMap" />
  <result property="another_table_name" resultMap="another_table_name.ibatorgenerated_BaseResultMap"
/>
</resultMap>

<select id="custom_selectByExample" ...>
  select
  <include refid="table_name.ibatorgenerated_ColumnsWithoutBLOBs" />
  ,
  <include refid="another_table_name.ibatorgenerated_ColumnsWithoutBLOBs" />
  from table_name
  left join another_table_name on ....
  ...
</select>

This would save us from modifying sqlmap manually when a new column is added to a table, for
example.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message