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

Improve handling of mapped backing properties in kotlin classes [DATAMONGO-2140]

Open
#3,009 1 comment 1 reaction 1 assignee View on GitHub

@mp911de is already working on this.

Since Dec 30, 2020.

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

Description

Knut Schleßelmann opened DATAMONGO-2140 and commented

Currently I try to find the best solution to map backing properties in kotlin. This is a common pattern if you want to expose an internal mutable collection as a read only collection property in the public API of a class.

I provided a small sample of the problem at https://github.com/kschlesselmann/kotlin-spring-data-mongo-mapping which results in

org.springframework.data.mapping.MappingException: No property list found on entity class com.example.demomongomapping.Test to bind constructor parameter to!

if Spring Data tries to bind the Document to the Class again.

One suggestion in gitter was to add @Field to constructor arguments like @JsonProperty from Jackson


Affects: 2.1.2 (Lovelace SR2)

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.