Skip to content

NullPointerException when saving an object with no "id" field or @Id annotation [DATAMONGO-1289] #2206

@spring-projects-issues

Description

@spring-projects-issues

Jon Gilmour opened DATAMONGO-1289 and commented

According to the documentation:

If no field or property specified above is present in the Java class then an implicit '_id' file will be generated by the driver but not mapped to a property or field of the Java class.

Instead of this, I'm seeing a NullPointerException when attempting to save an object that doesn't have an "id" field or an @Id annotated field.

This was working in 1.6.0, but seems to have changed at least in 1.6.2 (did not test 1.6.1) and is still not working as I expect in newer versions


Affects: 1.7.1 (Fowler SR1), 1.7.2 (Fowler SR2), 1.8 GA (Gosling)

Reference URL: https://gist.github.com/jmgilmour/9cbb1e9ebb2aa209725d

Referenced from: pull request #333

Backported to: 1.8.2 (Gosling SR2)

Metadata

Metadata

Labels

in: coreIssues in core supportin: mappingMapping and conversion infrastructurein: repositoryRepositories abstractiontype: bugA general bug

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions