There is a solution for this checked into SVN (not released yet). If
you build Abator from source you can specify that a column name should be
delimited for situations such as these.
In a nutshell, you specify this:
<abatorContext *beginningDelimiter="[" endingDelimiter="]"*>
...
<table schema="b0maschm" tableName="MAT_ORGSTRUCTURE"
enableInsert="false" enableUpdateByPrimaryKey="false"
enableDeleteByPrimaryKey="false" enableDeleteByExample="false">
<columnOverride column="function" property="functionCode"
*delimitedColumnName="true"* />
</table>
</abatorContext>
As I said, this is not released yet, but it is working.
Jeff Butler
On 9/18/07, Robert Glover <[EMAIL PROTECTED]> wrote:
>
> I need a workaround for a problem in Abator with Microsoft Sql Server.
>
> Abator generates the following SQL statment which gives an error (the
> problem
> is that "FUNCTION" is a keyword):
>
> select BUDGET_UNIT, FUNCTION, FUNCTION_NAME from
> b0maschm.MAT_ORGSTRUCTURE
>
> The error it gives is:
>
> --- The error occurred while applying a parameter map.
> --- Check the
>
> b0maschm_MAT_ORGSTRUCTURE.abatorgenerated_selectByExample-InlineParameterMap.
> --- Check the statement (query failed).
> --- Cause: java.sql.SQLException: [IBM][SQLServer JDBC
> Driver][SQLServer]Incorrect syntax near the keyword 'FUNCTION'.
> Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:
>
>
> As a workaround I can fix the error so that Abator works fine by going
> into the Abator generated file "b0maschm_MAT_ORGSTRUCTURE_SqlMap.xml" and
> changing the select to the following (notice the brackets around
> "function"):
>
> select BUDGET_UNIT, [FUNCTION], FUNCTION_NAME, from
> 0maschm.MAT_ORGSTRUCTURE
>
>
> Please advise if possible how to change the XML to stop this error. I
> tried
> the following but it had no effect on the SQl and the same error occured:
>
> <table schema="b0maschm" tableName="MAT_ORGSTRUCTURE"
> enableInsert="false" enableUpdateByPrimaryKey="false"
> enableDeleteByPrimaryKey="false" enableDeleteByExample="false">
> <columnOverride column="function" property="functionCode"/>
> </table>
>