Skip to content

Validation support to MongoTemplate [DATAMONGO-36] #975

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
spring-projects-issues opened this issue Jan 20, 2011 · 6 comments
Closed

Validation support to MongoTemplate [DATAMONGO-36] #975

spring-projects-issues opened this issue Jan 20, 2011 · 6 comments
Assignees
Labels
in: core Issues in core support type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link

Mark Pollack opened DATAMONGO-36 and commented

Spring 3.0 supports JSR-303. If

<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/>
is defined, we can ask the container for the validator (is there an Aware interface?) and then perform validation within MongoTemplate methods that take a POJO for Create, update, or delete operations.


Affects: 1.0 M2

Attachments:

Referenced from: commits 5b13307

1 votes, 3 watchers

@spring-projects-issues
Copy link
Author

Mark Pollack commented

This can be integrated into the eventing support in MongoTemplate

@spring-projects-issues
Copy link
Author

Mark Pollack commented

Mr. Walkowiak has provided the glue code for this

http://maciejwalkowiak.pl/blog/2012/04/20/jsr-303-validation-with-spring-data-mongodb/

@spring-projects-issues
Copy link
Author

Maciej Walkowiak commented

Pull request waiting for approval: #2

@spring-projects-issues
Copy link
Author

Oliver Drotbohm commented

Fixed by integrating Maciej's contribution. We now auto detect the presence of javax.validation API on the classpath and register an approrpiate Validator as well as an event listener that triggers validaton right before persisting the entities

@spring-projects-issues
Copy link
Author

Nune Isabekyan commented

Hi,

I cannot access this feature using latest - 1.0.2 GA version as it contains spring-mongo-1.0.xsd instead of needed spring-mongo-1.1.xsd.

Thanks in advance.
Regards,
Nune

@spring-projects-issues
Copy link
Author

Oliver Drotbohm commented

That's right as the support will was introduced in the 1.1.x timeline and will not be back-ported to the 1.0.x one. So you have to use the latest 1.1 version to get access to it. Please refrain from re-opening tickets that have been closed against an already released version as the ticket has already made it into the changelog already. Create a new ticket in case needed then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core support type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants