ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Butler <jeffgbut...@gmail.com>
Subject Re: Ibator: disable aliases for update and delete statements?
Date Sun, 09 Aug 2009 16:12:32 GMT
There's no support for this in Ibator now.  It will take a rewrite of
the example class generator at the very least - with support from new
SQL element generators too.

It also presents a bit of a usage problem for the iBATIS3 interface
mapper generator.  I haven't released this yet, but will soon.

So I'll have to think about this for a bit to come up with the best
way to deal with it.

Don't you love how "standard" SQL is?  I've never run into this in all
my testing, but I don't test with SQL Server regularly.  No problems
in MySql, HSQLDB, DB2, and (I think) PostgreSQL.

Jeff Butler



On Sun, Aug 9, 2009 at 10:11 AM, Chad McHenry<mchenryc@gmail.com> wrote:
> 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.
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Mime
View raw message