Skip to content

Jackson2RepositoryPopulatorFactoryBean fails to understand id alias [DATACOUCH-258] #571

Open
@spring-projects-issues

Description

@spring-projects-issues

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

Metadata

Metadata

Assignees

Labels

in: coreIssues in core supporttype: bugA general bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions