This message was deleted.
# spring
s
This message was deleted.
c
Mmmm, try to add
@org.springframework.transaction.annotation.Transactional
on the
update
fun.
s
okies, thank you @Czar
c
Explanation: You probably have something lazily initialized in your entity, you're getting it from the repository and then saving it back. Without
@Transactional
Spring Data finishes the transaction at repository method, so the
UserDao
entity is a POJO instead of managed bean. The lazily initialized stuff is therefore just empty and when you save
UserDao
you're effectively deleting all that stuff. If, on the other hand, the function is annotated with
@Transactional
, then both query and save operations happen in the same transaction and
UserDao
is a managed entity in-between.
s
I see @Transactional is already added in the service class, for update()
@Czar
c
It was missing in the screenshot. If it's there in the code, then no idea. Can you post full stacktrace? And I'd be greatful if you didn't use mentions unless absolutely necessary ­čÖé
s
Absoultely. Sorry about that
c
np