2020import org .woehlke .java .simpleworklist .domain .db .data .context .ContextRepository ;
2121
2222@ Slf4j
23- @ Service ( "userAccountService" )
24- // @Transactional(propagation = Propagation.REQUIRED, readOnly = true)
23+ @ Service
24+ @ Transactional (propagation = Propagation .REQUIRED , readOnly = true )
2525public class UserAccountServiceImpl implements UserAccountService {
2626
2727 private final UserAccountRepository userAccountRepository ;
@@ -30,7 +30,11 @@ public class UserAccountServiceImpl implements UserAccountService {
3030 private final PasswordEncoder encoder ;
3131
3232 @ Autowired
33- public UserAccountServiceImpl (UserAccountRepository userAccountRepository , ChatMessageRepository userMessageRepository , ContextRepository contextRepository ) {
33+ public UserAccountServiceImpl (
34+ UserAccountRepository userAccountRepository ,
35+ ChatMessageRepository userMessageRepository ,
36+ ContextRepository contextRepository
37+ ) {
3438 this .userAccountRepository = userAccountRepository ;
3539 this .userMessageRepository = userMessageRepository ;
3640 this .contextRepository = contextRepository ;
@@ -64,7 +68,7 @@ public void createUser(UserAccountForm userAccountForm) {
6468 }
6569
6670 @ Override
67- // @Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
71+ @ Transactional (propagation = Propagation .REQUIRES_NEW , readOnly = false )
6872 public UserAccount saveAndFlush (UserAccount u ) {
6973 return userAccountRepository .saveAndFlush (u );
7074 }
@@ -80,7 +84,7 @@ public Page<UserAccount> findAll(Pageable request) {
8084 }
8185
8286 @ Override
83- // @Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
87+ @ Transactional (propagation = Propagation .REQUIRES_NEW , readOnly = false )
8488 public void changeUsersPassword (UserAccountForm userAccount ) {
8589 UserAccount ua = userAccountRepository .findByUserEmail (userAccount .getUserEmail ());
8690 if (ua != null ) {
@@ -103,7 +107,8 @@ public Map<Long, Integer> getNewIncomingMessagesForEachOtherUser(UserAccount rec
103107 if (receiver .getId ().longValue () == sender .getId ().longValue ()){
104108 newIncomingMessagesForEachOtherUser .put (sender .getId (),0 );
105109 } else {
106- List <UserAccountChatMessage > userAccountChatMessages = userMessageRepository .findBySenderAndReceiverAndReadByReceiver (sender ,receiver ,false );
110+ List <UserAccountChatMessage > userAccountChatMessages =
111+ userMessageRepository .findBySenderAndReceiverAndReadByReceiver (sender ,receiver ,false );
107112 newIncomingMessagesForEachOtherUser .put (sender .getId (), userAccountChatMessages .size ());
108113 }
109114 }
0 commit comments