ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Larry Meadors" <lmead...@apache.org>
Subject Re: howto pass a Long argument to a query (isNotNull)
Date Fri, 18 Jan 2008 17:57:05 GMT
To use that in a dynamic query, I think it has to be wrapped - you
could pretty easily add it to a Map, or create a simple wrapper bean..

public class Wrapper {
  private Object value;
  public Wrapper(Object value){
    this.value = value;
  }
}

That would probably do it.

Larry


On Jan 18, 2008 10:30 AM, xianwinwin <xianwinwin@gmail.com> wrote:
>
> hi there,
>
> I'm trying to pass an argument to a query type java.lang.Long; for this I
> have:
>
>    <select id="secuser.select_user_group" parameterClass="java.lang.Long"
> resultMap="SecUser_group">
>
>             // query here
>
>                 <isNotNull prepend="AND" property="userId">
>                         SU.userId=#userId#
>                 </isNotNull>
>    </select>
>
> the invocation comes from
>
>         public List selectUserGroup(Long userId)
>         {
>                 List list = this.queryForList("secuser.select_user_group", userId);
>                 return list;
>         }
>
> problem is that I get the following error message:
>
> .
> .
> .
> --- Cause: com.ibatis.common.beans.ProbeException: There is no READABLE
> property named 'userId' in class 'java.lang.Long'
> Caused by: com.ibatis.common.beans.ProbeException: There is no READABLE
> property named 'userId' in class 'java.lang.Long'
> Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:
>
>
>
> I take it that there is no association between the (Long userId) and the
>
>                 <isNotNull prepend="AND" property="userId">
>                         SU.userId=#userId#
>                 </isNotNull>
>
> since I don't wish to pass an object (secuser) I wonder if it is possible to
> do it only with Long userID?
>
> thank you
> --
> View this message in context: http://www.nabble.com/howto-pass-a-Long-argument-to-a-query-%28isNotNull%29-tp14954009p14954009.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>

Mime
View raw message