ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris O'Connell" <oconn...@gorillachicago.com>
Subject Odd SQL Mapping error
Date Wed, 14 May 2008 14:53:53 GMT
When I am trying to execute an update through iBatis, I get a SQL Exception:
java.sql.SQLException: Invalid column type


Here is the mapping:

<update id="updateUserByUserID" parameterClass="User">


            PASS = #pass#,

            FIRST_NAME= #firstName#,

            LAST_NAME = #lastName#,

            TITLE = #title#,

            COMPANY = #company#,

            EMAIL = #email#,

            DESCRIPTION = #description#,

            USER_UUID = #uuid#,

            MODIFY_DATE = sysdate,

            SCREEN_NAME = #screenName#,

            TRADE_PORTAL_ID = #tradePortalId#


            USER_ID = #userId#



The error message is:

Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:   

--- The error occurred in User.xml.  

--- The error occurred while applying a parameter map.  

--- Check the User.updateUserByUserID-InlineParameterMap.  

--- Check the parameter mapping for the 'title' property.  

--- Cause: java.sql.SQLException: Invalid column type



What is happening is that I have a unit test that selects the user out of
the database, updates an attribute on the User object and then calls a
method to execute the 'updateUserByUserID' sql statement.  I checked the
database (Oracle) and the datatype of the TITLE column is "VARCHAR2(200)".
The type of the 'title' attribute on the User class is "String".  So, the
record in the database has "null" as the value of the TITLE, and I don't
update that in my code, so what I am trying to do is just set the TITLE back
to null in the update statement.  I am pretty sure that the 'setting back to
null' is what is causing the problem, because if I change the code so that I
explicitly set the title attribute to a non-null value and re-run the test,
I get the same error message, except the property changes so that I need to
check the parameter mapping for the 'company' property.


I'm guessing that I am missing something simple, but I have been looking at
this and my eyes are starting to cross.  Thanks for any help.



View raw message