We should probably continue discussing this topic, but FYI the particular 
problem I found was caused be a bug in the PrimaryKeyFinder code in the way it 
was setting up the context for the conversion routine. The lower level code was 
assuming it would be in the context, but the context had already been reduced 
to just the fields needed for the query.

A fix is in rev 916055.

-David


On Feb 24, 2010, at 1:05 PM, David E Jones wrote:

> 
> An update on this problem: It looks like it is another time zone issue, or in 
> other words another spot that doesn't manage time zones consistently (I won't 
> say correctly, because I'm not sure if that applies here... partly because 
> I'm not sure if I like the way that OFBiz handles time zones right now).
> 
> In any case, for demonstration purposes here is code that works:
> 
> <set field="fromDate" from-field="parameters.fromDate" type="Timestamp"/>
> <entity-one entity-name="ProductFeatureAndAppl" 
> value-field="productFeatureAndAppl" auto-field-map="false">
>    <field-map field-name="productId" from-field="parameters.productId"/>
>    <field-map field-name="productFeatureId" 
> from-field="parameters.productFeatureId"/>
>    <field-map field-name="fromDate" from-field="fromDate"/>
> </entity-one>
> 
> Here is code that does not work, but should:
> 
> <entity-one entity-name="ProductFeatureAndAppl" 
> value-field="productFeatureAndAppl" auto-field-map="false">
>    <field-map field-name="productId" from-field="parameters.productId"/>
>    <field-map field-name="productFeatureId" 
> from-field="parameters.productFeatureId"/>
>    <field-map field-name="fromDate" from-field="parameters.fromDate"/>
> </entity-one>
> 
> This also does not work, but should:
> 
> <entity-one entity-name="ProductFeatureAndAppl" 
> value-field="productFeatureAndAppl" auto-field-map="true"/>
> 
> The problem turns out to not be with the data type, but with the time zone 
> being treated differently in different cases.
> 
> I'll work on getting both of these to do the server-side time zone 
> compensation the same as the first one.
> 
> I'm wondering though: how many more places are not handling the time zone 
> correctly? Is there a better way to manage things when the user's time zone 
> setting is different from the server's? Right now it's a mess...
> 
> -David
> 
> 
> On Feb 23, 2010, at 10:03 PM, David E Jones wrote:
> 
>> 
>> What's strange is that this was working fine, even on MySQL, the last time I 
>> played with it. Unfortunately that was a bit of time ago so I don't have a 
>> good reference to narrow this down.
>> 
>> I'll try some things on Derby and see if I can reproduce it, and with more 
>> detailed steps to do so.
>> 
>> -David
>> 
>> 
>> On Feb 23, 2010, at 9:49 PM, Adrian Crum wrote:
>> 
>>> I was unable to reproduce the problem in the Example component using Derby.
>>> 
>>> -Adrian
>>> 
>>> --- On Tue, 2/23/10, David E Jones <[email protected]> wrote:
>>> 
>>>> From: David E Jones <[email protected]>
>>>> Subject: entity-one no longer converting types (probably a 
>>>> GenericEntity.setAllFields issue)
>>>> To: [email protected]
>>>> Date: Tuesday, February 23, 2010, 8:32 PM
>>>> 
>>>> Has anyone made any changes GenericEntity.setAllFields
>>>> method or the code underneath it? It no longer works unless
>>>> the primary key consists only of String type fields.
>>>> 
>>>> This is easy to reproduce, even in the Example Application,
>>>> by trying to work with ExampleFeatureAppl records, which
>>>> have a fromDate as part of the primary key.
>>>> 
>>>> This warning is showing, and the underlying code does not
>>>> work (on MySQL at least):
>>>> 
>>>> 
>>>>    [java] 2010-02-23 21:22:42,706
>>>> (http-0.0.0.0-8443-1) [     
>>>> GenericEntity.java:422:WARN ] 
>>>>    [java] ---- exception report
>>>> ----------------------------------------------------------
>>>>    [java] =-=-=-=-=-=-=-=-= Database
>>>> type warning GenericEntity.set =-=-=-=-=-=-=-=-= In entity
>>>> field [ProductFeatureAndAppl.fromDate] set the value passed
>>>> in [java.lang.String] is not compatible with the Java type
>>>> of the field [java.sql.Timestamp]
>>>>    [java] Exception:
>>>> java.lang.Exception
>>>>    [java] Message: Location of
>>>> database type warning
>>>>    [java] ---- stack trace
>>>> ---------------------------------------------------------------
>>>>    [java] java.lang.Exception:
>>>> Location of database type warning
>>>>    [java]
>>>> org.ofbiz.entity.GenericEntity.set(GenericEntity.java:422)
>>>>    [java]
>>>> org.ofbiz.entity.GenericEntity.set(GenericEntity.java:368)
>>>>    [java]
>>>> org.ofbiz.entity.GenericEntity.setAllFields(GenericEntity.java:885)
>>>>    [java]
>>>> org.ofbiz.entity.finder.PrimaryKeyFinder.runFind(PrimaryKeyFinder.java:105)
>>>>    [java]
>>>> org.ofbiz.entity.finder.PrimaryKeyFinder.runFind(PrimaryKeyFinder.java:81)
>>>>    [java]
>>>> org.ofbiz.widget.screen.ModelScreenAction$EntityOne.runAction(ModelScreenAction.java:523)
>>>> 
>>>> -David
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>>> 
>> 
> 

Reply via email to