@Transient and transient in java

When I was doing some coding with GSon, I found there are you kinds of transient. One is from Java key words, another is JPA annotation as explained in SF.

Java key word

transient is to prevent member field from being serialized, so that those fields will not appear in JSON format if you use Gson to serialize them.
This feature is very important if you have nested class member or collection field members.

JPA Annotation

This annotation is in JPA specification to indicate that there is no need to persist this field to database.


@Transient and transient in java
https://rug.al/2015/2015-08-17-transient-and-@transient-in-java/
Author
Rugal Bernstein
Posted on
August 17, 2015
Licensed under