You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by BJ Freeman <bj...@free-man.net> on 2010/07/12 17:43:55 UTC

Correct way to convert was svn commit: r959470 - in /ofbiz/trunk/framework/entity: dtd/ entitydef/ fieldtype/ src/org/ofbiz/entity/jdbc/ src/org/ofbiz/entity/model/ src/org/ofbiz/entity/test/

maybe add this to:

http://ofbiz.apache.org/docs/entity.html
https://cwiki.apache.org/confluence/display/OFBIZ/Mini-Language+Guide

https://cwiki.apache.org/confluence/display/OFBIZ/FAQ+-+Tips+-+Tricks+-+Cookbook+-+HowTo

Adrian Crum sent the following on 7/12/2010 7:52 AM:
> Matthieu,
>
> The correct Java data type must be sent to the entity engine -
> conversions are not supported any more. That was the original behavior.
>
> The entity engine automated tests test the field data types. If those
> tests pass on your installation, then the error you are encountering is
> not due to this commit.
>
> You can perform a data type conversion in mini-language by using the
> <set> element and specifying the target data type:
>
> <set field="doubleValue" from-field="bigDecimalValue" type="Double"/>
>
> -Adrian
>
> On 7/12/2010 7:29 AM, Matthieu Bollot wrote:
>> Le mercredi 30 juin 2010 à 23:27 +0000, adrianc@apache.org a écrit :
>>> Author: adrianc
>>> Date: Wed Jun 30 23:27:24 2010
>>> New Revision: 959470
>>>
>>> URL: http://svn.apache.org/viewvc?rev=959470&view=rev
>>> Log:
>>> Some work on the entity engine:
>>>
>>> 1. Removed the conversion framework from the entity engine. Type
>>> conversions should be done higher up in the stack. The basic pattern
>>> is the same, but instead of each ModelFieldType containing a
>>> converter instance, it now contains a JdbcValueHandler instance. The
>>> JdbcValueHandler performs the same task as the original switch
>>> statement - in effect each ModelFieldType contains its own piece of
>>> the switch statement.
>> ../..
>>> This has been tested on Advantage, Derby, and MySQL. It should be
>>> completely backward compatible. I will be monitoring the dev mailing
>>> list closely for any problems.
>>
>> Hi,
>> I think I've found a problem, seeable in createCalendarExceptionDay
>> service.
>>
>> When launched, I've got an error :
>> Error in Service [createCalendarExceptionDay]: Error running the
>> simple-method: Error in simple-method operation [<if-not-empty
>> field-name="newEntity.calendarId" map-name=""/>]:
>> java.lang.RuntimeException: Error in simple-method operation
>> [<create-value/>]: java.lang.ClassCastException: java.math.BigDecimal
>> cannot be cast to java.lang.Double<br/>null
>>
>> I've seen a patch from hans type="Double" instead of BigDecimal but in
>> createCalendarExceptionDay,<create-value value-field="newEntity"
>> type="Double"/> does not work.
>>
>> I think that this will not be the only one error related to convert from
>> BigDecimal to Double, and I thought that everything should be BigDecimal
>> instead of Double… so is there something more "global" to do ?
>>
>> tell me if I can help.
>>
>> PS : you could see the error using the selenium here :
>> http://selenium.neogia.org/ofbiz/tests/ManufacturingCreateCalendarAndWeek.html
>>
>>
>>
>