Class SplibJpaExceptionHandler
SplibExceptionHandler.
Use this class when the app uses JPA.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.web.servlet.ModelAndViewhandleObjectOptimisticLockingFailureException(org.springframework.orm.ObjectOptimisticLockingFailureException exception, org.springframework.security.core.userdetails.UserDetails loginUser) CatchesObjectOptimisticLockingFailureExceptionand treats the optimistic exclusive controls.org.springframework.web.servlet.ModelAndViewhandlePessimisticLockingFailureException(org.springframework.dao.PessimisticLockingFailureException exception, org.springframework.security.core.userdetails.UserDetails loginUser) CatchesPessimisticLockingFailureException.
-
Constructor Details
-
SplibJpaExceptionHandler
public SplibJpaExceptionHandler()
-
-
Method Details
-
handleObjectOptimisticLockingFailureException
@ExceptionHandler(org.springframework.orm.ObjectOptimisticLockingFailureException.class) public org.springframework.web.servlet.ModelAndView handleObjectOptimisticLockingFailureException(org.springframework.orm.ObjectOptimisticLockingFailureException exception, @AuthenticationPrincipal org.springframework.security.core.userdetails.UserDetails loginUser) throws Exception CatchesObjectOptimisticLockingFailureExceptionand treats the optimistic exclusive controls.Optimistic exclusive control causes an exception when a record is updated in the interval between pressing the button and actually updating the record (A).
But usually optimistic exclusive control is also needed when a record is updated in the interval between displaying the screen and pressing the button (B), and in the interval between displaying the record in the list page and displaying the detail page by selecting the record in the list page (C).(A) is implemented by JPA, and(A) throws
ObjectOptimisticLockingFailureException.
(A) automatically works so app developer don't have to cares about it. On the other hand (B) and (C) is not implemented by JPA, so it's implemented inecuacion-splib.
But inecuacion-splib(B) and (C) also throwsObjectOptimisticLockingFailureExceptionfor integrated handling.- Throws:
Exception
-
handlePessimisticLockingFailureException
@ExceptionHandler(org.springframework.dao.PessimisticLockingFailureException.class) public org.springframework.web.servlet.ModelAndView handlePessimisticLockingFailureException(org.springframework.dao.PessimisticLockingFailureException exception, @AuthenticationPrincipal org.springframework.security.core.userdetails.UserDetails loginUser) throws Exception CatchesPessimisticLockingFailureException.- Parameters:
exception- exceptionloginUser- loginUser- Returns:
- ModelAndView
- Throws:
Exception- Exception
-