The xml mapping and the data classes aren't created with the
modeler, but the mapping is loadable without any error by the
modeler. I hope this use case is acceptable.
The Java type is java.lang.Double, while the DB type is shown as
DECIMAL in the modeler (and in the resulting map file) and the
created code uses a type cast to double according to this.
Without the definition of the relationship all goes well, records of
this table are loadable and the values are accessible as double
objects.
After adding a reference to another table, using the double
attribute as map key (source in the db-relationship attr-pair),
something is broken: records are still loadable (the relationship
isn't involved at all in this fetching), but accessing the attribute
in question gives the big decimal conversion fault.
The attribute is no FK, it's not indexed in the db and FireBird has
no constraints on this column. So I do not see what FireBird could
have to do with this.
Is the runtime adding of complimentary DbRelationships able to
modify the attribute type? I see messages concerning added
relationships (which for sure is caused by the home grown
generation process). Are the complementary relationships
mandatory or can I prevent cayenne from creating/using them?
Andrus Adamchik wrote:
>
> We stopped supporting FireBird some time back due to the lack of
> qualified volunteers, so I don't remember all the issues that we had
> with it. But still this seems weird... Just to doublecheck, what Java
> and DB type you entered for the object attribute and the corresponding
> column in the Modeler?
>
> Also is this column an FK? Meaningful FK's are generally a bad idea.
> I'd recommend you get the value via a related object instead.
>
> Andrus
>
> On Mar 10, 2008, at 9:30 PM, Walter Haas wrote:
>> Hello,
>>
>> after creating a relationship which uses a column of the mapped type
>> double
>> (decimal in db) as source field, the type cast of the readProperty
>> method
>> throws an exception. It seems that the value is stored as BigDecimal
>> if the
>> field is used in a relationship!?
>>
>> This happens in Cayenne 3.02M and 3.03M (used with JayBird/FireBird).
>> Is this intendet behaviour? Any way to prevent this from happening?
>>
>
>
-- View this message in context: http://www.nabble.com/Wrong-data-type-for-source-attribute-of-a-relationship--tp15951944p15975787.html Sent from the Cayenne - User mailing list archive at Nabble.com.
This archive was generated by hypermail 2.0.0 : Tue Mar 11 2008 - 06:18:38 EDT