You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Nikita Timofeev (Jira)" <ji...@apache.org> on 2025/02/14 11:33:00 UTC

[jira] [Created] (CAY-2882) Dynamic cast of injected values in object initialization

Nikita Timofeev created CAY-2882:
------------------------------------

             Summary: Dynamic cast of injected values in object initialization
                 Key: CAY-2882
                 URL: https://issues.apache.org/jira/browse/CAY-2882
             Project: Cayenne
          Issue Type: Improvement
          Components: Core Library
            Reporter: Nikita Timofeev
             Fix For: 4.2.2, 5.0-M2


This improvement addresses the logic behind Cayenne injecting initial values into created objects using expressions within the qualifier. Currently, this logic is quite strict, as it simply passes scalar values as-is to the "{{{}.writeProperty()"{}}} call.

This can result in issues such as a simple qualifier like {{"attr = 123"}} throwing a {{ClassCastException}} if the {{"attr"}} type is not `int`, but `long` or another numeric type.

The proposed change aims to simply allow for some basic widening conversions for numeric types. Additionally, we might consider string to date/time value conversions.

We have already laid some groundwork by allowing enum values as strings (CAY-2399).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)