Let's say I have a custom RuntimeException
one 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 is hinting to make it MyEntity
transitional or serializable.
How can I solve this situation?
I do not use any RMI, deleting everything. It is a relatively simple Spring boot web application with JPA in place.
What benefits can I use later if I made serializable MyEntity
?
source
share