Skip to content
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

DATAMONGO-36 - Validation support to MongoTemplate #2

Closed

Conversation

@maciejwalkowiak
Copy link

commented Apr 23, 2012

Added JSR-303 validation support to MongoTemplate. Once validating event listener is registered it is automatically invoked before objects are saved in database.

Automatic component registration via XML namespace will be added soon in separate pull request after this one is accepted. Changes are already made in another branch: https://github.com/maciejwalkowiak/spring-data-mongodb/tree/DATAMONGO-36-namespace

@odrotbohm

This comment has been minimized.

Copy link
Member

commented Apr 26, 2012

Cool stuff! Here are some minor things I'd like to see before I pull this stuff in and do the final polishing:

  1. Rename BeforeSaveValidator to ValidatingMongoEventListener.
  2. Use constructor injection and a final field for the Validator in the listener implementation (removes the need for InitializingBean)
  3. Adapt BeanDefinitionParser accordingly.
  4. Instead of introducing a new namespace element please simply add a disable-validation flag to <mongo:mapping-converter /> to turn validation off. This is to align with the semantics of <mvc:annotation-driven />. <mongo:mapping-converter /> is pretty much the analogous element.

Beyond that, this is very cool already. Thanks a ton!

Maciej Walkowiak added 2 commits Apr 23, 2012
- changed class name to ValidatingMongoEventListener
- replaced namespace validation-enabled to flag disable-validation in mongo:mapping-converter
- added integration tests
- minor fixes
@maciejwalkowiak

This comment has been minimized.

Copy link
Author

commented Apr 27, 2012

I am still learning how to use git properly and because of that commit f4f9e3b was made by accident (and it's message does not make much sense).

All requested changes applied. Thanks for good advices - I hope its now as it should be.

@odrotbohm

This comment has been minimized.

Copy link
Member

commented Apr 27, 2012

No need to be overly concerned about that. I'll go ahead and squash all commits into one before merging them back anyway. Changes look good, I'll have a go on that in a few minutes. Thanks a ton for the contribution. Would you mind filling out the form over here and post the sign-up number you get as confirmation back here in the comments? It's basically a formal way to allow us using your contribution under Apache V2.0 license.

@maciejwalkowiak

This comment has been minimized.

Copy link
Author

commented Apr 27, 2012

Confirmation number is: 25320120427042238

@odrotbohm

This comment has been minimized.

Copy link
Member

commented Apr 27, 2012

Brilliant, thanks!

@odrotbohm

This comment has been minimized.

Copy link
Member

commented Apr 27, 2012

I just pushed a squashed and polished commit of your changes to the master branch. See 5b13307 for details. Thanks again for the contribution!

@odrotbohm odrotbohm closed this Apr 27, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.