You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by guo weizhan <gu...@gmail.com> on 2008/11/29 16:36:53 UTC

the bug using IN operator with FindServices.java

Do you guys use the FindServices? It's seems there is the problem in
createCondition method when using the "IN" operator, the
EntityCondition.makeCondition need a collection as the value when using IN
operatot, but it's always pass the String value to this method, so It's
throw the exception "Message: Error in Service [executeFind]: Error running
Find on the [PartyAndUserLoginAndPerson] entity: SQL Exception while
executing the following:SELECT PTY.PARTY_ID, PTY.PARTY_TYPE_ID,
PTY.CREATED_DATE, ULN.USER_LOGIN_ID, ULN.CURRENT_PASSWORD,
ULN.PASSWORD_HINT, ULN.ENABLED, ULN.DISABLED_DATE_TIME,
ULN.SUCCESSIVE_FAILED_LOGINS, PER.LAST_NAME, PER.FIRST_NAME FROM
(OFBIZ.PARTY PTY INNER JOIN OFBIZ.USER_LOGIN ULN ON PTY.PARTY_ID =
ULN.PARTY_ID) INNER JOIN OFBIZ.PERSON PER ON PTY.PARTY_ID = PER.PARTY_ID
WHERE (PTY.PARTY_ID IN ?) (Syntax error: Encountered "?" at line 1, column
384.)"

I have changed the code like this:
 if (ignoreCase != null && ignoreCase.equals("Y")) {
             if(opString!= null && opString.equals("in")){
              cond =
EntityCondition.makeCondition(EntityFunction.UPPER_FIELD(fieldName),
(EntityComparisonOperator) fieldOp,toList(fieldValue.toUpperCase()));
             }
             else
              cond =
EntityCondition.makeCondition(EntityFunction.UPPER_FIELD(fieldName),
(EntityComparisonOperator) fieldOp,
EntityFunction.UPPER(fieldValue.toUpperCase()));
            } else {
             if(opString!= null && opString.equals("in")){
              cond = EntityCondition.makeCondition(fieldName,
(EntityComparisonOperator) fieldOp,toList(fieldValue));
             }
             else
              cond = EntityCondition.makeCondition(fieldName,
(EntityComparisonOperator) fieldOp, fieldValue);
            }
.....

Is the bug or I miss something??

Thank you!

Re: the bug using IN operator with FindServices.java

Posted by guo weizhan <gu...@gmail.com>.
the problem still here, although it don't throw the error.
I want search all the OrganId is  0001 or 0002, and use the performFindList
service.
So I set the value like this:pfInput.inputFields.OrganId_fld0_op=in and
pfInput.inputFields.OrganId_fld0_value=0001,0002 and invoke the service, the
generate where SQL is  OrganId in ('0001,0002')   but what I want is OrganId
in ('0001','0002').

2008/12/7 guo weizhan <gu...@gmail.com>

> This problem is fixed, by https://issues.apache.org/jira/browse/OFBIZ-1045
>
> 2008/11/30 guo weizhan <gu...@gmail.com>
>
> I updated the last version today, and still got this error...
>>
>> 2008/11/30 David E Jones <da...@hotwaxmedia.com>
>>
>>
>>> Which revision or version of OFBiz are you using?
>>>
>>> -David
>>>
>>>
>>>
>>> On Nov 29, 2008, at 10:36 AM, guo weizhan wrote:
>>>
>>> Do you guys use the FindServices? It's seems there is the problem in
>>>> createCondition method when using the "IN" operator, the
>>>> EntityCondition.makeCondition need a collection as the value when using
>>>> IN
>>>> operatot, but it's always pass the String value to this method, so It's
>>>> throw the exception "Message: Error in Service [executeFind]: Error
>>>> running
>>>> Find on the [PartyAndUserLoginAndPerson] entity: SQL Exception while
>>>> executing the following:SELECT PTY.PARTY_ID, PTY.PARTY_TYPE_ID,
>>>> PTY.CREATED_DATE, ULN.USER_LOGIN_ID, ULN.CURRENT_PASSWORD,
>>>> ULN.PASSWORD_HINT, ULN.ENABLED, ULN.DISABLED_DATE_TIME,
>>>> ULN.SUCCESSIVE_FAILED_LOGINS, PER.LAST_NAME, PER.FIRST_NAME FROM
>>>> (OFBIZ.PARTY PTY INNER JOIN OFBIZ.USER_LOGIN ULN ON PTY.PARTY_ID =
>>>> ULN.PARTY_ID) INNER JOIN OFBIZ.PERSON PER ON PTY.PARTY_ID = PER.PARTY_ID
>>>> WHERE (PTY.PARTY_ID IN ?) (Syntax error: Encountered "?" at line 1,
>>>> column
>>>> 384.)"
>>>>
>>>> I have changed the code like this:
>>>> if (ignoreCase != null && ignoreCase.equals("Y")) {
>>>>            if(opString!= null && opString.equals("in")){
>>>>             cond =
>>>> EntityCondition.makeCondition(EntityFunction.UPPER_FIELD(fieldName),
>>>> (EntityComparisonOperator) fieldOp,toList(fieldValue.toUpperCase()));
>>>>            }
>>>>            else
>>>>             cond =
>>>> EntityCondition.makeCondition(EntityFunction.UPPER_FIELD(fieldName),
>>>> (EntityComparisonOperator) fieldOp,
>>>> EntityFunction.UPPER(fieldValue.toUpperCase()));
>>>>           } else {
>>>>            if(opString!= null && opString.equals("in")){
>>>>             cond = EntityCondition.makeCondition(fieldName,
>>>> (EntityComparisonOperator) fieldOp,toList(fieldValue));
>>>>            }
>>>>            else
>>>>             cond = EntityCondition.makeCondition(fieldName,
>>>> (EntityComparisonOperator) fieldOp, fieldValue);
>>>>           }
>>>> .....
>>>>
>>>> Is the bug or I miss something??
>>>>
>>>> Thank you!
>>>>
>>>
>>>
>>
>

Re: the bug using IN operator with FindServices.java

Posted by guo weizhan <gu...@gmail.com>.
This problem is fixed, by https://issues.apache.org/jira/browse/OFBIZ-1045

2008/11/30 guo weizhan <gu...@gmail.com>

> I updated the last version today, and still got this error...
>
> 2008/11/30 David E Jones <da...@hotwaxmedia.com>
>
>
>> Which revision or version of OFBiz are you using?
>>
>> -David
>>
>>
>>
>> On Nov 29, 2008, at 10:36 AM, guo weizhan wrote:
>>
>> Do you guys use the FindServices? It's seems there is the problem in
>>> createCondition method when using the "IN" operator, the
>>> EntityCondition.makeCondition need a collection as the value when using
>>> IN
>>> operatot, but it's always pass the String value to this method, so It's
>>> throw the exception "Message: Error in Service [executeFind]: Error
>>> running
>>> Find on the [PartyAndUserLoginAndPerson] entity: SQL Exception while
>>> executing the following:SELECT PTY.PARTY_ID, PTY.PARTY_TYPE_ID,
>>> PTY.CREATED_DATE, ULN.USER_LOGIN_ID, ULN.CURRENT_PASSWORD,
>>> ULN.PASSWORD_HINT, ULN.ENABLED, ULN.DISABLED_DATE_TIME,
>>> ULN.SUCCESSIVE_FAILED_LOGINS, PER.LAST_NAME, PER.FIRST_NAME FROM
>>> (OFBIZ.PARTY PTY INNER JOIN OFBIZ.USER_LOGIN ULN ON PTY.PARTY_ID =
>>> ULN.PARTY_ID) INNER JOIN OFBIZ.PERSON PER ON PTY.PARTY_ID = PER.PARTY_ID
>>> WHERE (PTY.PARTY_ID IN ?) (Syntax error: Encountered "?" at line 1,
>>> column
>>> 384.)"
>>>
>>> I have changed the code like this:
>>> if (ignoreCase != null && ignoreCase.equals("Y")) {
>>>            if(opString!= null && opString.equals("in")){
>>>             cond =
>>> EntityCondition.makeCondition(EntityFunction.UPPER_FIELD(fieldName),
>>> (EntityComparisonOperator) fieldOp,toList(fieldValue.toUpperCase()));
>>>            }
>>>            else
>>>             cond =
>>> EntityCondition.makeCondition(EntityFunction.UPPER_FIELD(fieldName),
>>> (EntityComparisonOperator) fieldOp,
>>> EntityFunction.UPPER(fieldValue.toUpperCase()));
>>>           } else {
>>>            if(opString!= null && opString.equals("in")){
>>>             cond = EntityCondition.makeCondition(fieldName,
>>> (EntityComparisonOperator) fieldOp,toList(fieldValue));
>>>            }
>>>            else
>>>             cond = EntityCondition.makeCondition(fieldName,
>>> (EntityComparisonOperator) fieldOp, fieldValue);
>>>           }
>>> .....
>>>
>>> Is the bug or I miss something??
>>>
>>> Thank you!
>>>
>>
>>
>

Re: the bug using IN operator with FindServices.java

Posted by guo weizhan <gu...@gmail.com>.
I updated the last version today, and still got this error...

2008/11/30 David E Jones <da...@hotwaxmedia.com>

>
> Which revision or version of OFBiz are you using?
>
> -David
>
>
>
> On Nov 29, 2008, at 10:36 AM, guo weizhan wrote:
>
> Do you guys use the FindServices? It's seems there is the problem in
>> createCondition method when using the "IN" operator, the
>> EntityCondition.makeCondition need a collection as the value when using IN
>> operatot, but it's always pass the String value to this method, so It's
>> throw the exception "Message: Error in Service [executeFind]: Error
>> running
>> Find on the [PartyAndUserLoginAndPerson] entity: SQL Exception while
>> executing the following:SELECT PTY.PARTY_ID, PTY.PARTY_TYPE_ID,
>> PTY.CREATED_DATE, ULN.USER_LOGIN_ID, ULN.CURRENT_PASSWORD,
>> ULN.PASSWORD_HINT, ULN.ENABLED, ULN.DISABLED_DATE_TIME,
>> ULN.SUCCESSIVE_FAILED_LOGINS, PER.LAST_NAME, PER.FIRST_NAME FROM
>> (OFBIZ.PARTY PTY INNER JOIN OFBIZ.USER_LOGIN ULN ON PTY.PARTY_ID =
>> ULN.PARTY_ID) INNER JOIN OFBIZ.PERSON PER ON PTY.PARTY_ID = PER.PARTY_ID
>> WHERE (PTY.PARTY_ID IN ?) (Syntax error: Encountered "?" at line 1, column
>> 384.)"
>>
>> I have changed the code like this:
>> if (ignoreCase != null && ignoreCase.equals("Y")) {
>>            if(opString!= null && opString.equals("in")){
>>             cond =
>> EntityCondition.makeCondition(EntityFunction.UPPER_FIELD(fieldName),
>> (EntityComparisonOperator) fieldOp,toList(fieldValue.toUpperCase()));
>>            }
>>            else
>>             cond =
>> EntityCondition.makeCondition(EntityFunction.UPPER_FIELD(fieldName),
>> (EntityComparisonOperator) fieldOp,
>> EntityFunction.UPPER(fieldValue.toUpperCase()));
>>           } else {
>>            if(opString!= null && opString.equals("in")){
>>             cond = EntityCondition.makeCondition(fieldName,
>> (EntityComparisonOperator) fieldOp,toList(fieldValue));
>>            }
>>            else
>>             cond = EntityCondition.makeCondition(fieldName,
>> (EntityComparisonOperator) fieldOp, fieldValue);
>>           }
>> .....
>>
>> Is the bug or I miss something??
>>
>> Thank you!
>>
>
>

Re: the bug using IN operator with FindServices.java

Posted by David E Jones <da...@hotwaxmedia.com>.
Which revision or version of OFBiz are you using?

-David


On Nov 29, 2008, at 10:36 AM, guo weizhan wrote:

> Do you guys use the FindServices? It's seems there is the problem in
> createCondition method when using the "IN" operator, the
> EntityCondition.makeCondition need a collection as the value when  
> using IN
> operatot, but it's always pass the String value to this method, so  
> It's
> throw the exception "Message: Error in Service [executeFind]: Error  
> running
> Find on the [PartyAndUserLoginAndPerson] entity: SQL Exception while
> executing the following:SELECT PTY.PARTY_ID, PTY.PARTY_TYPE_ID,
> PTY.CREATED_DATE, ULN.USER_LOGIN_ID, ULN.CURRENT_PASSWORD,
> ULN.PASSWORD_HINT, ULN.ENABLED, ULN.DISABLED_DATE_TIME,
> ULN.SUCCESSIVE_FAILED_LOGINS, PER.LAST_NAME, PER.FIRST_NAME FROM
> (OFBIZ.PARTY PTY INNER JOIN OFBIZ.USER_LOGIN ULN ON PTY.PARTY_ID =
> ULN.PARTY_ID) INNER JOIN OFBIZ.PERSON PER ON PTY.PARTY_ID =  
> PER.PARTY_ID
> WHERE (PTY.PARTY_ID IN ?) (Syntax error: Encountered "?" at line 1,  
> column
> 384.)"
>
> I have changed the code like this:
> if (ignoreCase != null && ignoreCase.equals("Y")) {
>             if(opString!= null && opString.equals("in")){
>              cond =
> EntityCondition.makeCondition(EntityFunction.UPPER_FIELD(fieldName),
> (EntityComparisonOperator) fieldOp,toList(fieldValue.toUpperCase()));
>             }
>             else
>              cond =
> EntityCondition.makeCondition(EntityFunction.UPPER_FIELD(fieldName),
> (EntityComparisonOperator) fieldOp,
> EntityFunction.UPPER(fieldValue.toUpperCase()));
>            } else {
>             if(opString!= null && opString.equals("in")){
>              cond = EntityCondition.makeCondition(fieldName,
> (EntityComparisonOperator) fieldOp,toList(fieldValue));
>             }
>             else
>              cond = EntityCondition.makeCondition(fieldName,
> (EntityComparisonOperator) fieldOp, fieldValue);
>            }
> .....
>
> Is the bug or I miss something??
>
> Thank you!