spring-projects / spring-projects/spring-data-mongodb

MappingMongoContext.shouldCreatePersistentEntityFor() does not consider simple types [DATAMONGO-1826]

Open
#2,687 0 comments 0 reactions 1 assignee View on GitHub

@mp911de is already working on this.

Since Dec 30, 2020.

in: mapping type: bug
Dominant language
Java
Stars
1.7k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

Mark Paluch opened DATAMONGO-1826 and commented

MappingMongoContext creates persistent entities for types which are considered to be simple ones. The actual issue occurs on encapsulated runtimes such as Java 9 where we attempt to introspect types with deep reflection. The memory consumed by superfluous entities is a less considerable aspect.

The effect of creating superfluous entities is not entirely a harm. It's also a feature which allows usage of the mapping context for types that have a custom converter registered. Preventing persistent entity creation would break existing functionality coming out of entity metadata (such as query mapping, determining a collection name).

We should investigate whether we can preserve that functionality to some degree while excluding unwanted typed from the mapping context. One approach could be opt-in using the @Document annotation or via the initial entity set


Affects: 2.0.1 (Kay SR1)

Issue Links:

  • DATAMONGO-1819 Discovering the preferred constructor lead to InaccessibleObjectException with Java 9

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.