If you want a general answer, I would recommend using Serializable for JPA entities that also assume the role of DTOs. So you could safely transport them across layers, especially from the business to the view layer. Note that in the current architecture, there isn't a need to use Serializable, primarily because we use Jackson (used in RESTEasy) to serialize JPA entities to JSON; the Jackson data binding model ignores Serializable.
As to why you notice Serializable being used in Show, that's down to the history of the class in this application.
The same answer goes for serialVersionUID. If your entities are not serialized using the Java native serialization mechanism, you could suppress the warning. You'd need this when you use remote EJBs etc. and transport JPA entities over the wire (where native serialization is likely to be used).
Vineet Reynolds
If you want a general answer, I would recommend using Serializable for JPA entities that also assume the role of DTOs. So you could safely transport them across layers, especially from the business to the view layer. Note that in the current architecture, there isn't a need to use Serializable, primarily because we use Jackson (used in RESTEasy) to serialize JPA entities to JSON; the Jackson data binding model ignores Serializable.
As to why you notice Serializable being used in Show, that's down to the history of the class in this application.
The same answer goes for serialVersionUID. If your entities are not serialized using the Java native serialization mechanism, you could suppress the warning. You'd need this when you use remote EJBs etc. and transport JPA entities over the wire (where native serialization is likely to be used).
9:35 p.m., Tuesday Nov. 19
Moderate this comment by email
Email address: vineet.reynolds@gmail.com | IP address: 122.166.176.114
Reply to this email with “Delete”, “Approve”, or “Spam”, or moderate from the Disqus moderation panel.