Skip to main content

Posts

Showing posts from May, 2013

Spring MVC - Ajax based form processing using JQuery and JSON with server side validation

Spring MVC provides support for processing the form as well as server side validation. It maps request parameters to form backing bean and validate the bean object if we have used @Valid annotation. When we submit the form, form get displayed with the error messages if validation is failed. Error messages are managed by Spring MVC and spring MVC binds them to the input fields. But, If we want to submit the form using ajax request, form page will not refresh and spring MVC cannot send validation error messages to browsers. In this case, server side validation does not work as per my expectations. So here I devised my approach to use the spring MVC validation even in ajax based form submission.  I am using JQuery to serialize the form data and capturing them in controller. In controller, form data is being mapped in User bean and User bean is validated based on field validation annotations. Now if validation is get failed and some errors are appeared there, I collect them in UserJso

WARNING: SQL Error: 1062, SQLState: 23000 SEVERE: Duplicate entry '*' for key '************'

May 14, 2013 4:35:23 PM org.hibernate.util.JDBCExceptionReporter logExceptions WARNING: SQL Error: 1062, SQLState: 23000 May 14, 2013 4:35:23 PM org.hibernate.util.JDBCExceptionReporter logExceptions SEVERE: Duplicate entry '2' for key 'navigation_id' May 14, 2013 4:35:23 PM org.hibernate.event.def.AbstractFlushingEventListener performExecutions SEVERE: Could not synchronize database state with session org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update     at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96)     at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)     at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)     at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)     at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:183)     at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(Ab