Created
August 25, 2025 08:06
-
-
Save michaelkotor/9e5c8db66440024d3e333b96d97c6e18 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Service | |
| public class UserSrvc { | |
| public UserRepository mySrvc; | |
| public UserSrvc() { | |
| this.mySrvc = new UserRepository(); | |
| } | |
| public User doSmthngImportant(Long id) { | |
| if (id == null) { | |
| return null; | |
| } | |
| try { | |
| return doDatabaseWork(id); | |
| } catch (Exception e) { | |
| } | |
| return null; | |
| } | |
| @Transactional | |
| private User doDatabaseWork(Long userID) { | |
| System.out.println("Doing something very important"); | |
| User u = mySrvc.findById(userID).get(); | |
| u.setName("UpdatedName"); | |
| mySrvc.save(u); | |
| return u; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment