the bug using IN operator with FindServices.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

the bug using IN operator with FindServices.java

guo weizhan
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!
Reply | Threaded
Open this post in threaded view
|

Re: the bug using IN operator with FindServices.java

David E Jones-3

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!

Reply | Threaded
Open this post in threaded view
|

Re: the bug using IN operator with FindServices.java

guo weizhan
I updated the last version today, and still got this error...

2008/11/30 David E Jones <[hidden email]>

>
> 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!
>>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: the bug using IN operator with FindServices.java

guo weizhan
This problem is fixed, by https://issues.apache.org/jira/browse/OFBIZ-1045

2008/11/30 guo weizhan <[hidden email]>

> I updated the last version today, and still got this error...
>
> 2008/11/30 David E Jones <[hidden email]>
>
>
>> 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!
>>>
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: the bug using IN operator with FindServices.java

guo weizhan
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 <[hidden email]>

> This problem is fixed, by https://issues.apache.org/jira/browse/OFBIZ-1045
>
> 2008/11/30 guo weizhan <[hidden email]>
>
> I updated the last version today, and still got this error...
>>
>> 2008/11/30 David E Jones <[hidden email]>
>>
>>
>>> 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!
>>>>
>>>
>>>
>>
>