In its default configuration, the Spring Framework’s transaction infrastructure code only marks a transaction for rollback in the case of runtime, unchecked exceptions; that is, when the thrown exception is an instance or subclass of RuntimeException. ( Errors will also - by default - result in a rollback). Checked exceptions that are thrown from a transactional method do not result in rollback in the default configuration.
[ { "birthDate":"1989-02-22", "firstName":"Tom", "lastName":"Lin", "gender":"M", "hireDate":"2019-02-10" }, { "birthDate":"1985-05-25", "firstName":"Judy", "lastName":"Chen", "gender":"F", "hireDate":"2019-02-10" }, { "birthDate":"1987-12-25", "firstName":"my name is so loooooooooooooooooooooooooooooooooooooooooooooon", "lastName":"Wu", "gender":"M", "hireDate":"2019-02-10" } ]
2019-02-19 13:24:51.796 WARN 61330 --- [nio-8080-exec-1] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 1406, SQLState: 22001 2019-02-19 13:24:51.796 ERROR 61330 --- [nio-8080-exec-1] o.h.engine.jdbc.spi.SqlExceptionHelper : Data truncation: Data too long for column 'first_name' at row 1 2019-02-19 13:24:51.807 ERROR 61330 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement] with root cause
com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Data too long for column 'first_name' at row 1