Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
4.2.RC1
-
None
-
None
Description
Columns mapped in DbEntity, but not mapped in ObjEntity are still included in the generated INSERT statements because of this:
public InsertBatchQuery(DbEntity entity, int batchCapacity) { super(entity, new ArrayList<>(entity.getAttributes()), batchCapacity); }
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.
CALC_COLUMN decimal(12,6) GENERATED ALWAYS AS ((COL_A / COL_B)) STORED,
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).