spring-projects / spring-projects/spring-data-couchbase

Jackson2RepositoryPopulatorFactoryBean fails to understand id alias [DATACOUCH-258]

Open
#571 1 comment 0 reactions 1 assignee View on GitHub

@davidkelly is already working on this.

Since Dec 31, 2020.

in: core type: bug
Dominant language
Java
Stars
284
Forks
197
PR merge metrics
No merged PRs in 30d

Description

Abhijit Sarkar opened DATACOUCH-258 and commented

Jackson2RepositoryPopulatorFactoryBean coming from spring-data-commons:1.12.13.RELEASE fails with the following error message when the document id field is aliased.

public class AppIdAppKeyPair {
    @Id
    @Field("alias")
    private String appId;
    @Field
    private String appKey;
}
[
  {
    "_class": "package.AppIdAppKeyPair",
    "alias": "admin",
    "appKey": "secret"
  }
]
@Bean
Jackson2RepositoryPopulatorFactoryBean jackson2Populator() {
    ClassPathResource resource1 = new ClassPathResource("/auth.json");
    Jackson2RepositoryPopulatorFactoryBean jackson2Populator = new Jackson2RepositoryPopulatorFactoryBean();
    jackson2Populator.setResources(new Resource[]{resource1});

    return jackson2Populator;
}

org.springframework.data.mapping.model.MappingException: An ID property is needed, but not found on this entity.


Affects: 1.4.6 (Gosling SR6)

1 votes, 2 watchers

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.