ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lieven De Keyzer" <lieven_dekey...@hotmail.com>
Subject Update / subquery
Date Sun, 29 May 2005 05:05:55 GMT
This statement returns an SQLException, saying I got an error in my SQL 
I can't seem to find one, so my question is: Is this possible in Ibatis?

<update id="updateAccount" parameterClass="account">
    UPDATE account
    SET email= #email#, first_name = #firstName#, last_name = #lastName#, 
password = #password#,  role_id = (SELECT role_id FROM role WHERE rolename = 
    WHERE username = #username#

  <resultMap id="accountResult" class="account">
    <result property="username" column="username"/>
    <result property="email" column="email"/>
    <result property="firstName" column="first_name"/>
    <result property="lastName" column="last_name"/>
    <result property="role" column="rolename"/>
    <result property="password" column="password"/>
    <result property="rootId" column="folder_id"/>

The error:
Cause: java.sql.SQLException: You have an error in your SQL syntax. Check 
the manual that corresponds to your MySQL server version for the right 
syntax to use near 'SELECT role_id FROM role WHERE rolename = 'admin')

View raw message