java - How does spring MVC do form validation (using hibernate) -


i following tutorial, showed how build using spring mvc framework simple form can validated.

we created function annotated using requestmapping added @valid annotation first argument of function along side @modelattribute annotation. let's call first argument type classa.

now in classa annotated of properties hibernate validation annotations (e.g. @notnull, @pattern, etc...)

what trying understand how working?

i checked code @interface notnull example , nothing.

i assuming spring mvc framework, uses reflection detect first argument of requestmapping function annotated using valid, when form submitted calls something validate classa properties.

where something? in hibernate? code please... how did spring figure out call hibernate code, added hibernate jars project @ no point told spring use them.

also, specification binds spring mvc hibernate?

can simple terms , using high level (and references of code if possible) explain me how things working?

i new , coming c++ things done differently. trying understand mechanisms behind workings of spring.

what seeing spring's support jsr-303 bean validation api. annotations such @notnull, @pattern part of jsr. since jsr (basically, jsr set of interfaces), needs concrete implementation in order work (called provider). here hibernate comes in picture. hibernate owns implementation of jsr-303, called hibernate-validator. api has nothing core orm functionalities of hibernate. in fact, api reference implementation of jsr-303, why in documentation see used default provider.

so user of spring framework, need know spring needs find implementation of jsr-303 in classpath can start using annotation javax.validation.* package.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -