Skip to content

DATAMONGO-1289 - NullPointerException when saving an object with no "id" field or @Id annotation. #333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

christophstrobl
Copy link
Member

!!! DO NOT MERGE !!! Opened for discussion.

We now use RepositoryMetdata.getIdType() to provide a fallback id type once the EntityInformation does not hold an id property which is perfectly valid for mongodb. This is a bit more sophisticated than just defaulting to ObjectId but requires us to use the RepositoryMetadata which is not available when calling RepositoryFactorySupport.getEntityInformation.

Having that said we might want to think about changing the method signature of getEntityInformation so it takes RepositoryMetdata wich would allow us to access the required data.

…id" field or @id annotation.

Prepare issue branch.
Add tests that show it works using MongoTemplate but fails for the repository.
We now use RepositoryMetdata#getIdType to provide a fallback id type once the entity information does not hold an id property which is perfectly valid for mongodb. This is a bit more sophisticated than just default to ObjectId.
christophstrobl added a commit that referenced this pull request Dec 16, 2015
…ifier type derived from repository declaration.

We now use RepositoryMetdata.getIdType() to provide a fallback identifier type in case the entity information does not hold an id property which is perfectly valid for MongoDB.

Original pull request: #333.
odrotbohm added a commit that referenced this pull request Dec 16, 2015
Some additional JavaDoc and comment removal.

Original pull request: #333.
@odrotbohm odrotbohm closed this Dec 16, 2015
@odrotbohm odrotbohm deleted the issue/DATAMONGO-1289 branch December 16, 2015 10:47
christophstrobl added a commit that referenced this pull request Dec 16, 2015
…ifier type derived from repository declaration.

We now use RepositoryMetdata.getIdType() to provide a fallback identifier type in case the entity information does not hold an id property which is perfectly valid for MongoDB.

Original pull request: #333.
odrotbohm added a commit that referenced this pull request Dec 16, 2015
Some additional JavaDoc and comment removal.

Original pull request: #333.
@odrotbohm odrotbohm self-assigned this Dec 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants