Let's say I have my custom RuntimeException, where MyEntity is JPA @Entity:
@Getter
public class MyEntityAlreadyExistingException extends RuntimeException {
    private final MyEntity myEntity;
    public MyEntityAlreadyExistingException(MyEntity myEntity) {
        super(MessageFormat.format("MyEntity with name \"{0}\" already exists", myEntity.getName()));
        this.myEntity = myEntity;
    }
}
Sonar hints me to make myEntity transient or serializable.
How should I deal with this situation?
I don't use any RMI, remoting whatsoever. It is relatively simple Spring Boot web application with JPA in place.
What advantages are there I could leverage later on if I made myEntity serializable?
 
    