Transient

In the context of Java, 
the transient keyword is used as field modifier.
If we declare a field as transient; that field would not be serialized even if the class implements Serializable.

private transient int count;

In Java, transient is used only for fields, so methods, classes and interfaces can not be declared as transient.


In the context of persistance systems, such as Hibernate, 
transient is one of the object states that describes; an object has been instantiated using the new operator, but is not associated with a Hibernate session. That means the object resides in the memory but is not being persisted

In that part of the game, @Transient annotation comes into play. The annotation javax.persistence.Transient, declares that an object's state can not change from transient to persistent; meaning that the object cannot be bound to persistence context and so cannot be persisted to a backing store.

@Transient
private String model;

Yorumlar

Popular

Java 14 New Features

Pretenders, Contenders and Liars

Java 12 New Features