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 smime.p7s (3K) Download Attachment |
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 |
In reply to this post by Joe Eckard
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 [hidden email] H1:480-626-8022 H2:480-802-7173 Yahoo IM: stephen_rufle AOL IM: stephen1rufle |
In reply to this post by Adrian Crum
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 |
In reply to this post by Stephen Rufle-2
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 > [hidden email] > H1:480-626-8022 > H2:480-802-7173 > Yahoo IM: stephen_rufle > AOL IM: stephen1rufle |
Free forum by Nabble | Edit this page |