In ORM and OOP , a transient field is generally a field that isn't included in the serialization process. Use this tag for questions related to behavior related to the transient keyword.
Questions tagged [transient]
414 questions
1636
votes
15 answers
375
votes
8 answers
Why does JPA have a @Transient annotation?
Java has the transientkeyword. Why does JPA have @Transient instead of simply using the already existing java keyword?

deamon
- 89,107
- 111
- 320
- 448
190
votes
3 answers
What does the keyword "transient" mean in Java?
I saw somewhere
transient private TrackDAO trackDAO;
user562350
72
votes
1 answer
What is the purpose of AccessType.FIELD, AccessType.PROPERTY and @Access
I just want to know what is the difference between all these annotations. Why are we using these... means they have no effect especially field level and property level.
And what is the purpose of using mixed level annotation…

Ashish Bansal
- 904
- 1
- 9
- 11
59
votes
4 answers
Why jackson is serializing transient member also?
I am serializing a POJO into JSON using Jackson 2.1.4 but I want to ignore a particular field from getting serialized. I used transient but still it is serializing that element.
public class TestElement {
int x;
private transient String…

Naman
- 2,569
- 4
- 27
- 44
56
votes
2 answers
Java: Static transient fields
I just found out in Java you can declare a field 'static transient' - the compiler doesn't complain. This doesn't seem to be useful in any way since static fields are not serialized, as we all know.
But I wonder, is there actually a case where…

python dude
- 7,980
- 11
- 40
- 53
47
votes
2 answers
Android Room: @Ignore vs Transient
Are those two interchangable in context of Room database entity, or, if not, what are the differences between them?

Pavlus
- 1,651
- 1
- 13
- 24
44
votes
7 answers
Java static serialization rules?
I'm working on a save state serialization with a few static methods and fields. I could have sworn though that serialization and static's caused mayhem. Should I make all static's transient? And will inflating the calls restore the statics as…

ahodder
- 11,353
- 14
- 71
- 114
41
votes
6 answers
Why does ArrayList use transient storage?
I was reading the source of Java's ArrayList and I came across its backing array declaration:
private transient Object[] elementData;
Why does this need to be transient? Why can't this class be serialized?
Thanks for the help!

Jack K
- 463
- 5
- 10
29
votes
1 answer
how do I find out if a Java field has the transient modifier?
In the Java reflection world -
how do we find out if a Field object has the transient modifier?
http://docs.oracle.com/javase/tutorial/reflect/member/fieldModifiers.html
the documentation is not helping.

Alexander Mills
- 90,741
- 139
- 482
- 817
28
votes
2 answers
Difference when serializing a lazy val with or without @transient
Working on spark, sometimes I need to send a non-serializable object in each task.
A common pattern is @transient lazy val, e.g
class A(val a: Int)
def compute(rdd: RDD[Int]) = {
// lazy val instance = {
@transient lazy val instance = {
…

Hao Ren
- 956
- 1
- 9
- 17
27
votes
1 answer
@Transient annotation, @org.springframework.data.annotation.Transient annotation, transient keyword and password storing
Currently I'm learning the Spring framework, mainly focusing on it's Security Module. I've watched some guides in connection with registration and login. I saw this common usage of transient keyword or @Transient annotation on the password field in…

F3R1
- 493
- 1
- 5
- 15
26
votes
6 answers
Can transient keywords mark a method?
In a java class java.util.Locale, I find that the keyword transient marked a method.
public final class Locale
implements Cloneable, Serializable
{
private static class LocaleNameGetter
implements…

Chuanshi Liu
- 514
- 1
- 7
- 11
23
votes
1 answer
When to use SQLITE_TRANSIENT vs SQLITE_STATIC?
I would like to create/update text columns in sqlite3.
When i retrieve rows after the create/update, the text is '?'.
Integer values are properly persisted however.
My text statements look like this:
const char *sql = "INSERT INTO todo(title,…

Edward An
- 1,727
- 5
- 15
- 16
20
votes
1 answer
How to make controllers scoped or singleton instead of transient in ASP.NET Core?
How to make controllers scoped or singleton instead of transient in ASP.NET Core?
I now that by default the controllers are registered with the default DI container with the transient lifetime.
In case I would like to register them with a different…

Sasuke Uchiha
- 857
- 2
- 11
- 23