Re: svn commit: r949617 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java

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

Re: svn commit: r949617 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java

Jacques Le Roux
Administrator
Hi Adam,

Beginning at this commit (actually I had to use a dichotomic research between 949599 and 949628, the joy of git bursting when you
use svn on your end ;o), I get the error below

2010-06-01 22:11:30,656 (http-0.0.0.0-8443-5) [  ServiceDispatcher.java:543:ERROR] Error in Service [executeFind]: Error running
Find on the [ProductSearchNoNotInUse] entity: SQL Exception while executing the
 following:SELECT DISTINCT PR.PRODUCT_ID, PR.PRODUCT_TYPE_ID, PR.PRIMARY_PRODUCT_CATEGORY_ID, PR.PRODUCT_NAME FROM public.PRODUCT PR
LEFT OUTER JOIN public.SUPPLIER_PRODUCT SP ON PR.PRODUCT_ID = SP.PRODUCT_ID
 WHERE  AND ((PR.PRODUCT_TYPE_ID <> ? OR PR.PRODUCT_TYPE_ID IS NULL)) ORDER BY PR.PRODUCT_NAME ASC (ERREUR: erreur de syntaxe sur ou
prÞs de ½ AND +
  Position: 206)

If I simply revert it, it looks ok. As it begins to be late here, for now I have simply reverted it at r950237

HTH

Jacques

> Author: doogie
> Date: Sun May 30 22:07:55 2010
> New Revision: 949617
>
> URL: http://svn.apache.org/viewvc?rev=949617&view=rev
> Log:
> Add new variants of makeConditionWhereString that take a StringBuilder, and deprecate the old versions that don't.
>
> Modified:
>    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java
>
> Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java?rev=949617&r1=949616&r2=949617&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java (original)
> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java Sun May 30 22:07:55 2010
> @@ -695,11 +695,7 @@ public class GenericDAO {
>
>         // WHERE clause
>         List<EntityConditionParam> whereEntityConditionParams = FastList.newInstance();
> -        StringBuilder whereString = makeConditionWhereString(modelEntity, whereEntityCondition, viewWhereConditions,
> whereEntityConditionParams);
> -        if (whereString.length() > 0) {
> -            sqlBuffer.append(" WHERE ");
> -            sqlBuffer.append(whereString.toString());
> -        }
> +        makeConditionWhereString(sqlBuffer, " WHERE ", modelEntity, whereEntityCondition, viewWhereConditions,
> whereEntityConditionParams);
>
>         // GROUP BY clause for view-entity
>         if (modelViewEntity != null) {
> @@ -765,7 +761,12 @@ public class GenericDAO {
>         return new EntityListIterator(sqlP, modelEntity, selectFields, modelFieldTypeReader, this, whereEntityCondition,
> havingEntityCondition, findOptions.getDistinct());
>     }
>
> +    @Deprecated
>     protected StringBuilder makeConditionWhereString(ModelEntity modelEntity, EntityCondition whereEntityCondition,
> List<EntityCondition> viewWhereConditions, List<EntityConditionParam> whereEntityConditionParams) throws GenericEntityException {
> +        return makeConditionWhereString(new StringBuilder(), "", modelEntity, whereEntityCondition, viewWhereConditions,
> whereEntityConditionParams);
> +    }
> +
> +    protected StringBuilder makeConditionWhereString(StringBuilder whereString, String prefix, ModelEntity modelEntity,
> EntityCondition whereEntityCondition, List<EntityCondition> viewWhereConditions, List<EntityConditionParam>
> whereEntityConditionParams) throws GenericEntityException {
>         ModelViewEntity modelViewEntity = null;
>         if (modelEntity instanceof ModelViewEntity) {
>             modelViewEntity = (ModelViewEntity) modelEntity;
> @@ -786,7 +787,10 @@ public class GenericDAO {
>
>         String viewClause = SqlJdbcUtil.makeViewWhereClause(modelEntity, datasourceInfo.joinStyle);
>
> -        StringBuilder whereString = new StringBuilder();
> +        if (entityCondWhereString.length() > 0 || UtilValidate.isNotEmpty(viewEntityCondWhereString) || viewClause.length() > 0)
> {
> +            whereString.append(prefix);
> +        }
> +
>         if (entityCondWhereString.length() > 0) {
>             boolean addParens = entityCondWhereString.charAt(0) != '(';
>             if (addParens) whereString.append("(");
> @@ -1040,11 +1044,7 @@ public class GenericDAO {
>
>         // WHERE clause
>         List<EntityConditionParam> whereEntityConditionParams = FastList.newInstance();
> -        StringBuilder whereString = makeConditionWhereString(modelEntity, whereEntityCondition, viewWhereConditions,
> whereEntityConditionParams);
> -        if (whereString.length() > 0) {
> -            sqlBuffer.append(" WHERE ");
> -            sqlBuffer.append(whereString.toString());
> -        }
> +        makeConditionWhereString(sqlBuffer, " WHERE ", modelEntity, whereEntityCondition, viewWhereConditions,
> whereEntityConditionParams);
>
>         // GROUP BY clause for view-entity
>         if (isGroupBy) {
>
>


Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r949617 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java

David E. Jones-2

Thanks Jacques, I saw this error too last night but hand't had a chance to look into it.

-David


On Jun 1, 2010, at 2:29 PM, Jacques Le Roux wrote:

> Hi Adam,
>
> Beginning at this commit (actually I had to use a dichotomic research between 949599 and 949628, the joy of git bursting when you use svn on your end ;o), I get the error below
>
> 2010-06-01 22:11:30,656 (http-0.0.0.0-8443-5) [  ServiceDispatcher.java:543:ERROR] Error in Service [executeFind]: Error running Find on the [ProductSearchNoNotInUse] entity: SQL Exception while executing the
> following:SELECT DISTINCT PR.PRODUCT_ID, PR.PRODUCT_TYPE_ID, PR.PRIMARY_PRODUCT_CATEGORY_ID, PR.PRODUCT_NAME FROM public.PRODUCT PR LEFT OUTER JOIN public.SUPPLIER_PRODUCT SP ON PR.PRODUCT_ID = SP.PRODUCT_ID
> WHERE  AND ((PR.PRODUCT_TYPE_ID <> ? OR PR.PRODUCT_TYPE_ID IS NULL)) ORDER BY PR.PRODUCT_NAME ASC (ERREUR: erreur de syntaxe sur ou prÞs de ½ AND +
> Position: 206)
>
> If I simply revert it, it looks ok. As it begins to be late here, for now I have simply reverted it at r950237
>
> HTH
>
> Jacques
>
>> Author: doogie
>> Date: Sun May 30 22:07:55 2010
>> New Revision: 949617
>>
>> URL: http://svn.apache.org/viewvc?rev=949617&view=rev
>> Log:
>> Add new variants of makeConditionWhereString that take a StringBuilder, and deprecate the old versions that don't.
>>
>> Modified:
>>   ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java
>>
>> Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java?rev=949617&r1=949616&r2=949617&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java (original)
>> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java Sun May 30 22:07:55 2010
>> @@ -695,11 +695,7 @@ public class GenericDAO {
>>
>>        // WHERE clause
>>        List<EntityConditionParam> whereEntityConditionParams = FastList.newInstance();
>> -        StringBuilder whereString = makeConditionWhereString(modelEntity, whereEntityCondition, viewWhereConditions, whereEntityConditionParams);
>> -        if (whereString.length() > 0) {
>> -            sqlBuffer.append(" WHERE ");
>> -            sqlBuffer.append(whereString.toString());
>> -        }
>> +        makeConditionWhereString(sqlBuffer, " WHERE ", modelEntity, whereEntityCondition, viewWhereConditions, whereEntityConditionParams);
>>
>>        // GROUP BY clause for view-entity
>>        if (modelViewEntity != null) {
>> @@ -765,7 +761,12 @@ public class GenericDAO {
>>        return new EntityListIterator(sqlP, modelEntity, selectFields, modelFieldTypeReader, this, whereEntityCondition, havingEntityCondition, findOptions.getDistinct());
>>    }
>>
>> +    @Deprecated
>>    protected StringBuilder makeConditionWhereString(ModelEntity modelEntity, EntityCondition whereEntityCondition, List<EntityCondition> viewWhereConditions, List<EntityConditionParam> whereEntityConditionParams) throws GenericEntityException {
>> +        return makeConditionWhereString(new StringBuilder(), "", modelEntity, whereEntityCondition, viewWhereConditions, whereEntityConditionParams);
>> +    }
>> +
>> +    protected StringBuilder makeConditionWhereString(StringBuilder whereString, String prefix, ModelEntity modelEntity, EntityCondition whereEntityCondition, List<EntityCondition> viewWhereConditions, List<EntityConditionParam> whereEntityConditionParams) throws GenericEntityException {
>>        ModelViewEntity modelViewEntity = null;
>>        if (modelEntity instanceof ModelViewEntity) {
>>            modelViewEntity = (ModelViewEntity) modelEntity;
>> @@ -786,7 +787,10 @@ public class GenericDAO {
>>
>>        String viewClause = SqlJdbcUtil.makeViewWhereClause(modelEntity, datasourceInfo.joinStyle);
>>
>> -        StringBuilder whereString = new StringBuilder();
>> +        if (entityCondWhereString.length() > 0 || UtilValidate.isNotEmpty(viewEntityCondWhereString) || viewClause.length() > 0) {
>> +            whereString.append(prefix);
>> +        }
>> +
>>        if (entityCondWhereString.length() > 0) {
>>            boolean addParens = entityCondWhereString.charAt(0) != '(';
>>            if (addParens) whereString.append("(");
>> @@ -1040,11 +1044,7 @@ public class GenericDAO {
>>
>>        // WHERE clause
>>        List<EntityConditionParam> whereEntityConditionParams = FastList.newInstance();
>> -        StringBuilder whereString = makeConditionWhereString(modelEntity, whereEntityCondition, viewWhereConditions, whereEntityConditionParams);
>> -        if (whereString.length() > 0) {
>> -            sqlBuffer.append(" WHERE ");
>> -            sqlBuffer.append(whereString.toString());
>> -        }
>> +        makeConditionWhereString(sqlBuffer, " WHERE ", modelEntity, whereEntityCondition, viewWhereConditions, whereEntityConditionParams);
>>
>>        // GROUP BY clause for view-entity
>>        if (isGroupBy) {
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r949617 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java

Adam Heath-2
In reply to this post by Jacques Le Roux
Jacques Le Roux wrote:
> Hi Adam,
>
> Beginning at this commit (actually I had to use a dichotomic research
> between 949599 and 949628, the joy of git bursting when you use svn on
> your end ;o), I get the error below

git bisect helps for that too.  :)


>
> 2010-06-01 22:11:30,656 (http-0.0.0.0-8443-5) [
> ServiceDispatcher.java:543:ERROR] Error in Service [executeFind]: Error
> running Find on the [ProductSearchNoNotInUse] entity: SQL Exception
> while executing the
> following:SELECT DISTINCT PR.PRODUCT_ID, PR.PRODUCT_TYPE_ID,
> PR.PRIMARY_PRODUCT_CATEGORY_ID, PR.PRODUCT_NAME FROM public.PRODUCT PR
> LEFT OUTER JOIN public.SUPPLIER_PRODUCT SP ON PR.PRODUCT_ID = SP.PRODUCT_ID
> WHERE  AND ((PR.PRODUCT_TYPE_ID <> ? OR PR.PRODUCT_TYPE_ID IS NULL))
> ORDER BY PR.PRODUCT_NAME ASC (ERREUR: erreur de syntaxe sur ou prÞs de ½
> AND +
>  Position: 206)
>
> If I simply revert it, it looks ok. As it begins to be late here, for
> now I have simply reverted it at r950237

Thanks for finding a bug, and the exact revision that causes it.
Plus, giving me the web link(ProductSearchNoNotInUse) to cause it to
happen.  I haven't yet had time to replicate.
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r949617 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java

Adam Heath-2
Adam Heath wrote:

> Jacques Le Roux wrote:
>> Hi Adam,
>>
>> Beginning at this commit (actually I had to use a dichotomic research
>> between 949599 and 949628, the joy of git bursting when you use svn on
>> your end ;o), I get the error below
>
> git bisect helps for that too.  :)
>
>
>> 2010-06-01 22:11:30,656 (http-0.0.0.0-8443-5) [
>> ServiceDispatcher.java:543:ERROR] Error in Service [executeFind]: Error
>> running Find on the [ProductSearchNoNotInUse] entity: SQL Exception
>> while executing the
>> following:SELECT DISTINCT PR.PRODUCT_ID, PR.PRODUCT_TYPE_ID,
>> PR.PRIMARY_PRODUCT_CATEGORY_ID, PR.PRODUCT_NAME FROM public.PRODUCT PR
>> LEFT OUTER JOIN public.SUPPLIER_PRODUCT SP ON PR.PRODUCT_ID = SP.PRODUCT_ID
>> WHERE  AND ((PR.PRODUCT_TYPE_ID <> ? OR PR.PRODUCT_TYPE_ID IS NULL))
>> ORDER BY PR.PRODUCT_NAME ASC (ERREUR: erreur de syntaxe sur ou prÞs de ½
>> AND +
>>  Position: 206)
>>
>> If I simply revert it, it looks ok. As it begins to be late here, for
>> now I have simply reverted it at r950237
>
> Thanks for finding a bug, and the exact revision that causes it.
> Plus, giving me the web link(ProductSearchNoNotInUse) to cause it to
> happen.  I haven't yet had time to replicate.

I thought it was a controller entry.  It's not.  How do you cause this
bug to occur?
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r949617 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java

Adam Heath-2
Adam Heath wrote:

> Adam Heath wrote:
>> Jacques Le Roux wrote:
>>> Hi Adam,
>>>
>>> Beginning at this commit (actually I had to use a dichotomic research
>>> between 949599 and 949628, the joy of git bursting when you use svn on
>>> your end ;o), I get the error below
>> git bisect helps for that too.  :)
>>
>>
>>> 2010-06-01 22:11:30,656 (http-0.0.0.0-8443-5) [
>>> ServiceDispatcher.java:543:ERROR] Error in Service [executeFind]: Error
>>> running Find on the [ProductSearchNoNotInUse] entity: SQL Exception
>>> while executing the
>>> following:SELECT DISTINCT PR.PRODUCT_ID, PR.PRODUCT_TYPE_ID,
>>> PR.PRIMARY_PRODUCT_CATEGORY_ID, PR.PRODUCT_NAME FROM public.PRODUCT PR
>>> LEFT OUTER JOIN public.SUPPLIER_PRODUCT SP ON PR.PRODUCT_ID = SP.PRODUCT_ID
>>> WHERE  AND ((PR.PRODUCT_TYPE_ID <> ? OR PR.PRODUCT_TYPE_ID IS NULL))
>>> ORDER BY PR.PRODUCT_NAME ASC (ERREUR: erreur de syntaxe sur ou prÞs de ½
>>> AND +
>>>  Position: 206)
>>>
>>> If I simply revert it, it looks ok. As it begins to be late here, for
>>> now I have simply reverted it at r950237
>> Thanks for finding a bug, and the exact revision that causes it.
>> Plus, giving me the web link(ProductSearchNoNotInUse) to cause it to
>> happen.  I haven't yet had time to replicate.
>
> I thought it was a controller entry.  It's not.  How do you cause this
> bug to occur?

Nevermind, I see the problem.
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r949617 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java

Adam Heath-2
Adam Heath wrote:

> Adam Heath wrote:
>> Adam Heath wrote:
>>> Jacques Le Roux wrote:
>>>> Hi Adam,
>>>>
>>>> Beginning at this commit (actually I had to use a dichotomic research
>>>> between 949599 and 949628, the joy of git bursting when you use svn on
>>>> your end ;o), I get the error below
>>> git bisect helps for that too.  :)
>>>
>>>
>>>> 2010-06-01 22:11:30,656 (http-0.0.0.0-8443-5) [
>>>> ServiceDispatcher.java:543:ERROR] Error in Service [executeFind]: Error
>>>> running Find on the [ProductSearchNoNotInUse] entity: SQL Exception
>>>> while executing the
>>>> following:SELECT DISTINCT PR.PRODUCT_ID, PR.PRODUCT_TYPE_ID,
>>>> PR.PRIMARY_PRODUCT_CATEGORY_ID, PR.PRODUCT_NAME FROM public.PRODUCT PR
>>>> LEFT OUTER JOIN public.SUPPLIER_PRODUCT SP ON PR.PRODUCT_ID = SP.PRODUCT_ID
>>>> WHERE  AND ((PR.PRODUCT_TYPE_ID <> ? OR PR.PRODUCT_TYPE_ID IS NULL))
>>>> ORDER BY PR.PRODUCT_NAME ASC (ERREUR: erreur de syntaxe sur ou prÞs de ½
>>>> AND +
>>>>  Position: 206)
>>>>
>>>> If I simply revert it, it looks ok. As it begins to be late here, for
>>>> now I have simply reverted it at r950237
>>> Thanks for finding a bug, and the exact revision that causes it.
>>> Plus, giving me the web link(ProductSearchNoNotInUse) to cause it to
>>> happen.  I haven't yet had time to replicate.
>> I thought it was a controller entry.  It's not.  How do you cause this
>> bug to occur?
>
> Nevermind, I see the problem.

Fixed in 950339.