Class SplibJpaExceptionHandler
java.lang.Object
jp.ecuacion.splib.web.exceptionhandler.SplibExceptionHandler
jp.ecuacion.splib.web.jpa.exceptionhandler.SplibJpaExceptionHandler
SplibExceptionHandlerNoJpaに、jpa独自の例外処理を追加したクラス。JPAを使用している場合はこちらを継承。
-
Nested Class Summary
Nested classes/interfaces inherited from class jp.ecuacion.splib.web.exceptionhandler.SplibExceptionHandler
SplibExceptionHandler.ValidationErrorInfoBean -
Field Summary
Fields inherited from class jp.ecuacion.splib.web.exceptionhandler.SplibExceptionHandler
INFO_FOR_ERROR_HANDLING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.web.servlet.ModelAndViewhandleObjectOptimisticLockingFailureException(org.springframework.orm.ObjectOptimisticLockingFailureException exception, org.springframework.security.core.userdetails.UserDetails loginUser) 楽観的排他制御の処理。org.springframework.web.servlet.ModelAndViewhandlePessimisticLockingFailureException(org.springframework.dao.PessimisticLockingFailureException exception, org.springframework.security.core.userdetails.UserDetails loginUser) Methods inherited from class jp.ecuacion.splib.web.exceptionhandler.SplibExceptionHandler
getController, handleAppException, handleAppWarningException, handleHttpRequestMethodNotSupportedException, handleInputValidationException, handleNoResourceFoundException, handleOptimisticLockingFailureException, handleThrowable
-
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 楽観的排他制御の処理。 画面表示〜ボタン押下の間にレコード更新された場合は、手動でチェックなので直接BizLogicAppExceptionを投げても良いのだが、 複数sessionで同一レコードを同時更新した場合(service内の処理内でのselectからupdateの間に別sessionがselect〜updateを完了)は JPAが自動でObjectOptimisticLockingFailureExceptionを投げてくるので、それも同様に処理できるよう楽観的排他制御エラーは ObjectOptimisticLockingFailureExceptionで統一しておく。 尚、jpa以外でも、jdbcやfileでのlockでも同様の事象があるので全て統一しObjectOptimisticLockingFailureExceptionを使用するものとする。- 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 - Throws:
Exception
-