ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chad McHenry <mchen...@gmail.com>
Subject Ibator: disable aliases for update and delete statements?
Date Sun, 09 Aug 2009 15:11:04 GMT
Using SQL Server, I get syntax errors from Ibator generated deleteByExample
and updateByExample* for tables which I give an alias.
Neither deleteByPrimaryKey, updateByPrimaryKey, nor
updateByPrimaryKeySelective use of the alias, and work, but deleteByExample,
updateByExample, and updateByExampleSelective use the alias, and fail.
I don't see a way to disable alias use in just the '*ByExample*' statements
without creating "Example_Where_Clause_Without_Aliases" sql fragment, and
using that instead of the "Example_Where_Clause", but that would take a lot
of rewriting of the auto generated stuff or an Ibator plugin.

Any suggestions?

    <table tableName="user" alias="u" delimitIdentifiers="true" />

generates:

  <delete id="ibatorgenerated_deleteByPrimaryKey"
parameterClass="model.User">
    <!--
      WARNING - This element is automatically generated by Apache iBATIS
ibator, do not modify.
    -->
    delete from "user"
    where id = #id:VARCHAR#
  </delete>
  <delete id="ibatorgenerated_deleteByExample"
parameterClass="model.UserExample">
    <!--
      WARNING - This element is automatically generated by Apache iBATIS
ibator, do not modify.
    -->
    delete "user" from "user" u
    <include refid="user.ibatorgenerated_Example_Where_Clause" />
  </delete>

deleteByPrimaryKey works fine, but deleteByExample fails with bad-syntax
error, due to the aliases which SQLServer 2005 does not like in delete or
update statements.

Mime
View raw message