You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by "Wible, Thomas E" <Th...@mdnt.com> on 2006/01/26 18:30:06 UTC

problem with

i've inherited a mySQL db using a tomcat web-frontend and ibatis sqlmaps
(the original db designer has since left, natch)-:
and have picked up the dialect ok until now:
 
i've added a new column to an existing table, added all the supporting
java data object code (it retrieves data i've poked into the column just
fine) but it barfs on the following sqlmap:
 
    <insert id="insertsql" parameterClass="myclass">
        insert into mytable set lastchangedate = NOW()
        <dynamic>
            <isNotEmpty prepend="," property="oldcolumnvalue"> 
                `oldcolumnname` = $oldcolumnvalue$
            </isNotEmpty>
           <isNotEmpty prepend="," property="newcolumnvalue">
                `newcolumnname` = $newcolumnvalue$
            </isNotEmpty>
       </dynamic>
    </insert>
 
and i get the following java.sql.SQLexception:
 
    column not found, msg from server: unknown column 'newcolumnvalue'
in 'field list'
 
somehow the newcolumnvalue is being seen as the newcolumnname...wtf???
the new code is cut&pasted from existing(and working, until the mods)
code...and i've been unsuccessful in getting log4j debug output
(java.sql?)to work...
 
can i buy a clue, please?
thanx
tom

Re: problem with

Posted by Jeff Butler <je...@gmail.com>.
I think there's a fundamental problem here....

What you're generating is in no way a valid SQL statement.  Maybe this is
a copy/paste error?  Looks like the words "insert into" got put on the front
of an old update statement.

Jeff Butler



On 1/26/06, Wible, Thomas E <Th...@mdnt.com> wrote:
>
> i've inherited a mySQL db using a tomcat web-frontend and ibatis sqlmaps
> (the original db designer has since left, natch)-:
> and have picked up the dialect ok until now:
>
> i've added a new column to an existing table, added all the supporting
> java data object code (it retrieves data i've poked into the column just
> fine) but it barfs on the following sqlmap:
>
>     <insert id="insertsql" parameterClass="myclass">
>         insert into mytable set lastchangedate = NOW()
>         <dynamic>
>             <isNotEmpty prepend="," property="oldcolumnvalue">
> `oldcolumnname` = $oldcolumnvalue$
>             </isNotEmpty>
>            <isNotEmpty prepend="," property="newcolumnvalue">
>                 `newcolumnname` = $newcolumnvalue$
>             </isNotEmpty>
>        </dynamic>
>     </insert>
> and i get the following java.sql.SQLexception:
>
>     column not found, msg from server: unknown column 'newcolumnvalue'  in
> 'field list'
>
> somehow the newcolumnvalue is being seen as the newcolumnname...wtf??? the
> new code is cut&pasted from existing(and working, until the mods) code...and
> i've been unsuccessful in getting log4j debug output (java.sql?)to work...
>
> can i buy a clue, please?
> thanx
> tom
>

Re: problem with

Posted by Clinton Begin <cl...@gmail.com>.
You don't need the <dynamic> tag at all.  Just remove it.  The other
conditionals will work fine.

Cheers,
Clinton

On 1/26/06, Wible, Thomas E <Th...@mdnt.com> wrote:
>
> i've inherited a mySQL db using a tomcat web-frontend and ibatis sqlmaps
> (the original db designer has since left, natch)-:
> and have picked up the dialect ok until now:
>
> i've added a new column to an existing table, added all the supporting
> java data object code (it retrieves data i've poked into the column just
> fine) but it barfs on the following sqlmap:
>
>     <insert id="insertsql" parameterClass="myclass">
>         insert into mytable set lastchangedate = NOW()
>         <dynamic>
>             <isNotEmpty prepend="," property="oldcolumnvalue">
> `oldcolumnname` = $oldcolumnvalue$
>             </isNotEmpty>
>            <isNotEmpty prepend="," property="newcolumnvalue">
>                 `newcolumnname` = $newcolumnvalue$
>             </isNotEmpty>
>        </dynamic>
>     </insert>
> and i get the following java.sql.SQLexception:
>
>     column not found, msg from server: unknown column 'newcolumnvalue'  in
> 'field list'
>
> somehow the newcolumnvalue is being seen as the newcolumnname...wtf??? the
> new code is cut&pasted from existing(and working, until the mods) code...and
> i've been unsuccessful in getting log4j debug output (java.sql?)to work...
>
> can i buy a clue, please?
> thanx
> tom
>