Skip to content

Derived names difference between 1.6.0 and 1.9.1 #381

@LifeXplorer

Description

@LifeXplorer

Hello.
While migrating Java 11 -> 17 I updated sql2o package from 1.6.0 to 1.9.1.
The following code started to fall:
query .addColumnMapping("updated_at", "lastUpdatedAt") .setAutoDeriveColumnNames(true) .executeAndFetchFirst(MyObject.class)
By debugging the source code I can see that inside of PojoBuilder.withValue() function now the columnName is first changed to derivedName and only afterwards applied to provided columnMappings.
Along the code updated_at is transformed into updatedat and only then compared to the mapping provided.
To support both addColumnMapping for this specific parameter and setAutoDeriveColumnNames(true) for rest parameters, I had to workaround set column mapping as .addColumnMapping("updatedat", "lastUpdatedAt") which is pretty confusing and not straightforward.
I'd expect that deriving name convention would not be applied if I explicitly add custom column mapping.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions