You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Joe Eckard <jo...@redrocketcorp.com> on 2009/04/13 23:08:05 UTC
EntityCondition Question
What is the correct way to create a "having" condition that compares
two fields? For example:
HAVING available_to_promise_total <= minimum_stock ;
I can use:
havingCondition =
EntityCondition.makeCondition('availableToPromiseTotal',
EntityOperator.LESS_THAN_EQUAL_TO,
EntityFieldValue.makeFieldValue('minimumStock'));
which works, but I get the following warning:
=-=-=-=-=-=-=-=-= Database type warning in EntityExpr =-=-=-=-=-=-=-=-=
In entity field
[ProductFacilityLocationQuantityTest.availableToPromiseTotal] set the
value passed in [org.ofbiz.entity.condition.EntityFieldValue] is not
compatible with the Java type of the field [java.math.BigDecimal]
Is there a cleaner way to do this type of thing that I am overlooking?
-Joe
Re: EntityCondition Question
Posted by Joe Eckard <jo...@redrocketcorp.com>.
Right, the warning is somewhat irrelevant - I'm attempting to compare
a field to another field, not a value - I was just wondering if there
was a nicer way to do it.
On Apr 13, 2009, at 5:38 PM, Adrian Crum wrote:
> It is saying that one of your operator data types doesn't match the
> database data type. Make sure you're comparing a BigDecimal to a
> BigDecimal.
>
> -Adrian
>
> Joe Eckard wrote:
>> What is the correct way to create a "having" condition that
>> compares two fields? For example:
>> HAVING available_to_promise_total <= minimum_stock ;
>> I can use:
>> havingCondition =
>> EntityCondition.makeCondition('availableToPromiseTotal',
>> EntityOperator.LESS_THAN_EQUAL_TO,
>> EntityFieldValue.makeFieldValue('minimumStock'));
>> which works, but I get the following warning:
>> =-=-=-=-=-=-=-=-= Database type warning in EntityExpr =-=-=-=-=-=-=-
>> =-=
>> In entity field
>> [ProductFacilityLocationQuantityTest.availableToPromiseTotal] set
>> the value passed in [org.ofbiz.entity.condition.EntityFieldValue]
>> is not compatible with the Java type of the field
>> [java.math.BigDecimal]
>> Is there a cleaner way to do this type of thing that I am
>> overlooking?
>> -Joe
Re: EntityCondition Question
Posted by Adrian Crum <ad...@hlmksw.com>.
It is saying that one of your operator data types doesn't match the
database data type. Make sure you're comparing a BigDecimal to a BigDecimal.
-Adrian
Joe Eckard wrote:
> What is the correct way to create a "having" condition that compares two
> fields? For example:
>
> HAVING available_to_promise_total <= minimum_stock ;
>
> I can use:
>
> havingCondition =
> EntityCondition.makeCondition('availableToPromiseTotal',
> EntityOperator.LESS_THAN_EQUAL_TO,
> EntityFieldValue.makeFieldValue('minimumStock'));
>
> which works, but I get the following warning:
>
> =-=-=-=-=-=-=-=-= Database type warning in EntityExpr =-=-=-=-=-=-=-=-=
> In entity field
> [ProductFacilityLocationQuantityTest.availableToPromiseTotal] set the
> value passed in [org.ofbiz.entity.condition.EntityFieldValue] is not
> compatible with the Java type of the field [java.math.BigDecimal]
>
>
> Is there a cleaner way to do this type of thing that I am overlooking?
>
>
> -Joe
Re: EntityCondition Question
Posted by Joe Eckard <jo...@redrocketcorp.com>.
I think in that case it will try and convert the string 'minimumStock'
to a value.
On Apr 13, 2009, at 5:39 PM, Stephen Rufle wrote:
> I am not sure you need the
> EntityFieldValue.makeFieldValue('minimumStock').
>
> Could it be
>
> havingCondition =
> EntityCondition.makeCondition('availableToPromiseTotal',
> EntityOperator.LESS_THAN_EQUAL_TO, 'minimumStock');
>
> which would end up calling
> org.ofbiz.entity.condition.EntityCondition.makeCondition(Object,
> EntityComparisonOperator, Object)
>
>
> Joe Eckard wrote:
>> What is the correct way to create a "having" condition that compares
>> two fields? For example:
>>
>> HAVING available_to_promise_total <= minimum_stock ;
>>
>> I can use:
>>
>> havingCondition =
>> EntityCondition.makeCondition('availableToPromiseTotal',
>> EntityOperator.LESS_THAN_EQUAL_TO,
>> EntityFieldValue.makeFieldValue('minimumStock'));
>>
>> which works, but I get the following warning:
>>
>> =-=-=-=-=-=-=-=-= Database type warning in EntityExpr =-=-=-=-=-=-=-
>> =-=
>> In entity field
>> [ProductFacilityLocationQuantityTest.availableToPromiseTotal] set the
>> value passed in [org.ofbiz.entity.condition.EntityFieldValue] is not
>> compatible with the Java type of the field [java.math.BigDecimal]
>>
>>
>> Is there a cleaner way to do this type of thing that I am
>> overlooking?
>>
>>
>> -Joe
>
> --
> Stephen P Rufle
> srufle@salmonllc.com
> H1:480-626-8022
> H2:480-802-7173
> Yahoo IM: stephen_rufle
> AOL IM: stephen1rufle
Re: EntityCondition Question
Posted by Stephen Rufle <sr...@salmonllc.com>.
I am not sure you need the EntityFieldValue.makeFieldValue('minimumStock').
Could it be
havingCondition =
EntityCondition.makeCondition('availableToPromiseTotal',
EntityOperator.LESS_THAN_EQUAL_TO, 'minimumStock');
which would end up calling
org.ofbiz.entity.condition.EntityCondition.makeCondition(Object,
EntityComparisonOperator, Object)
Joe Eckard wrote:
> What is the correct way to create a "having" condition that compares
> two fields? For example:
>
> HAVING available_to_promise_total <= minimum_stock ;
>
> I can use:
>
> havingCondition =
> EntityCondition.makeCondition('availableToPromiseTotal',
> EntityOperator.LESS_THAN_EQUAL_TO,
> EntityFieldValue.makeFieldValue('minimumStock'));
>
> which works, but I get the following warning:
>
> =-=-=-=-=-=-=-=-= Database type warning in EntityExpr =-=-=-=-=-=-=-=-=
> In entity field
> [ProductFacilityLocationQuantityTest.availableToPromiseTotal] set the
> value passed in [org.ofbiz.entity.condition.EntityFieldValue] is not
> compatible with the Java type of the field [java.math.BigDecimal]
>
>
> Is there a cleaner way to do this type of thing that I am overlooking?
>
>
> -Joe
--
Stephen P Rufle
srufle@salmonllc.com
H1:480-626-8022
H2:480-802-7173
Yahoo IM: stephen_rufle
AOL IM: stephen1rufle