'When nullSafeSet from Hibernate UserType is calling

I created UserType for password encryption/decryption. And after select entities from db, UserType automaticly makes update, why?

Query query = entityManager.createNamedQuery(User.FIND_ALL);
List<User> result = query.getResultList();
// here in background is calling UserType.nullSafeGet() for password decryption, and this is OK
result.forEach(user -> entityManager.detach(user));
return result;
// here in background is calling UserType.nullSafeSet() for password encryption and trying to make UPDATE in db. Why?


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source