spring - Do I have to try-catch JpaRepository -


i using jparepository spring data jpa framework. have snippet of code below:

@repository public interface presetfolderrepository extends jparepository<presetfolder, integer>{      @modifying     @transactional     @query("update presetfolder pf set pf.parentid = :parentid pf.id = :id")     int updateparentid(@param("id") int id, @param("parentid") int parentid); } 

when invoke method:

@autowired presetfolderrepository repo;     repo.updateparentid(1,2); public void test(){ 

do have surround try-catch? how can know if self-defined method 'updateparentid' has try-catch implementation in it?

thanks!

edit: concern is, if database went down, method catch exception.

repositories tell if problem happens (i.e. never swallow exceptions). you'll runtime exception if that's case.

and should not catch such exception either, except @ top of call stack, have possibility display error message end user.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -