Yea, the problem is that you've specified a Long as the parameter and then
you've got a isNotNull testing, which is trying to do this kind of thing:
Long.getUserId()
Long.userId
Long.get("userId")
Which won't work. Besides what Larry said, you could also just pass in a
map:
public List selectUserGroup(Long userId)
{
Map params = new HashMap();
params.put("userId", userId);
List list = this.queryForList("secuser.select_user_group",
params);
return list;
}
Your select element would then look something like:
<select id="secuser.select_user_group" parameterClass="map"
resultMap="SecUser_group">
Cheers,
Chris
On 1/18/08 10:57 AM, "Larry Meadors" <[EMAIL PROTECTED]> wrote:
> 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 <[EMAIL PROTECTED]> 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-t
>> p14954009p14954009.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>