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 2026/08/18 08:38:03 UTC
[jira] [Updated] (CAY-2791) Unmapped columns are included in INSERT statements
[ https://issues.apache.org/jira/browse/CAY-2791?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Nikita Timofeev updated CAY-2791:
---------------------------------
Fix Version/s: 5.0-M3
(was: 5.0-M2)
> Unmapped columns are included in INSERT statements
> --------------------------------------------------
>
> Key: CAY-2791
> URL: https://issues.apache.org/jira/browse/CAY-2791
> Project: Cayenne
> Issue Type: Bug
> Affects Versions: 4.2.RC1
> Reporter: Andrus Adamchik
> Priority: Major
> Fix For: 5.0-M3
>
>
> Columns mapped in DbEntity, but not mapped in ObjEntity are still included in the generated INSERT statements because of this:
> {noformat}
> public InsertBatchQuery(DbEntity entity, int batchCapacity) {
> super(entity, new ArrayList<>(entity.getAttributes()), batchCapacity);
> }
> {noformat}
> This is not a new issue, but this is evil. It inserts explicit NULLs in all unmapped columns, which is too big of an assumption to always work. E.g. I have a case of "calculated" MySQL columns. Inserting NULLs in those causes exceptions.
> {noformat}
> CALC_COLUMN decimal(12,6) GENERATED ALWAYS AS ((COL_A / COL_B)) STORED,
> {noformat}
> The workaround for me was to use "exclude column" rules in DB Import. But the issue should still be addressed and not require a workaround. We need to only insert in the columns that are relevant for the ObjEntity (i.e. those mapped to ObjAttributes, pks and fks).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)