spring-projects / spring-projects/spring-data-relational

PersistentEntity not created when top-level converter [DATAJDBC-295]

Open
#520 9 comments 0 reactions 1 assignee View on GitHub

@schauder is already working on this.

Since Dec 31, 2020.

in: mapping type: enhancement
Dominant language
Java
Stars
827
Forks
394
PR merge metrics
No merged PRs in 30d

Description

Greg Potter opened DATAJDBC-295 and commented

When registering a customer Converter that uses Object or some other top-level class (perhaps in the form of a ConditionalConverter), Spring Data JDBC fails to think a PersistentEntity is required for the top-level object and creating the repository fails.

This is actually mentioned in the javadoc for AbstractMappingContext.shouldCreatePersistentEntityFor:

By default this will reject all types considered simple and non-supported Kotlin classes, but it might be necessary to tweak that in case you have registered custom converters for top level types (which renders them to be considered simple) but still need meta-information about them.

However, resolving this does not seem to be trivial since it's not easy to extend that method (simpleTypeHolder is private). I'm thinking we actually might want to try to convert it first (or at least go through the "match" process for a ConditionalConverter) before assuming that all converter sources are not entities


Issue Links:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.