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
19
votes
2 answers
Custom Core Data SectionNameKeyPath
I am new at core data and am trying to figure out how to create a custom sectionNameKeyPath in my NSFetchedResultsController. I have a managed object with an attribute called acctPeriod. It is a NSString. I want to create sections based on the first…

theDVUSone
- 215
- 1
- 2
- 5
18
votes
1 answer
Need some help understanding transient properties in Core Data
I read the documentation on transient properties but I can't really understand their purpose. Can someone tell me the difference between having and not having a transient property if I have a custom subclass of NSManagedObject like this?
@interface…

morningstar
- 8,952
- 6
- 31
- 42
17
votes
2 answers
What does @Transient annotation mean for methods?
So I have learned that the transient keyword in Java means that an entity does not persist, and that the @Transient annotation in JPA means don't persist a field to the database. But what does it mean when @Transient is applied to a method rather…

starsplusplus
- 1,232
- 3
- 19
- 32
15
votes
4 answers
Why use the `transient` keyword in java?
I have an issue related to the transient keyword's use before the private modifier in java .
variable declaration:
transient private ResourceBundle pageResourceBundle;
My class looks like this :
public class LoginViewModel extends…

Sitansu
- 3,225
- 8
- 34
- 61
13
votes
3 answers
How does marking a field as transient make it possible to serialise an object
public class Foo implements java.io.Serializable {
private int v1;
private static double v2;
private Loan v3 = new Loan();
}
Options:
A. An instance of Foo can be serialized because Foo implements Serializable.
B. An instance of Foo cannot…

zengr
- 38,346
- 37
- 130
- 192
12
votes
1 answer
Is there any difference between 'static transients' and 'transient Type aField' declaration for GORM?
Let us consider two Grails domain example classes.
1st class:
class Person {
String name
Integer counter = 0
static transients = ['counter']
}
2nd class:
class Vehicle {
String name
transient Integer counter = 0
}
Will there…

topr
- 4,482
- 3
- 28
- 35
11
votes
1 answer
Core Data, "sorting by transient property" workaround
Let's say I have a Core Data entity called Event, which represents recurrent (yearly) events. Each Event has a "date" property.
I need to present this events to the user sorted by "next occurrence of date". This property, of course, depends on the…

mips
- 278
- 1
- 5
- 9
11
votes
1 answer
@transient lazy val field serialization
I have a problem on Scala. I serialize an instance of class with @transient lazy val field. And then I deserialize it, the field is assigned null. I expect the lazy evaluation after deserialization. What should I do?
Following is a sample…

hydrocul
- 113
- 1
- 1
- 4
11
votes
2 answers
Why inserting 1000 000 values in a transient map in Clojure yields a map with 8 items in it?
If I try to do 1000 000 assoc! on a transient vector, I'll get a vector of 1000 000 elements
(count
(let [m (transient [])]
(dotimes [i 1000000]
(assoc! m i i)) (persistent! m)))
; => 1000000
on the other hand, if I do the same with a…

Zuzana
- 307
- 1
- 9
11
votes
4 answers
Can a transient field in a class be obtained using reflection
Can a transient field in a class be obtained using reflection? (using getDeclaredField(..))

java_geek
- 17,585
- 30
- 91
- 113
11
votes
4 answers
CoreData transient relationship example
Does anybody have an example on how to model and code a transient to-one relationship in CoreData? For example, I have 2 entities with a one-to-many relationship. Doctor and Appointment. Now I want an transient relationship called…

batkuip
- 1,480
- 3
- 15
- 25
10
votes
3 answers
@Transient not working in hibernate
I am using hibernate 4.1.9.
My code is
@Transient
private String ldapIdTemp;
package is
import javax.persistence.Transient;
Still in hibernate query, it is not working and putting the attribute in the query.
part of query snippet…

romil gaurav
- 1,121
- 11
- 23
- 43
10
votes
1 answer
Why is there no peek! function for clojure transient vectors?
Clojure has transient analogs for some of its persistent data structures, vectors, maps and sets. For vectors, there are pop! and conj! functions, analogous to pop and conj for persistent vectors, but no peek!.
Is there a technical reason that…

Rob Lachlan
- 14,289
- 5
- 49
- 99
10
votes
3 answers
Should @Transient property be used in equals/hashCode/toString?
I have JPA entities where some properties are annotated with @Transient.
Should I use these properties in equals/hashCode/toString methods?
My first thought is NO but I don't know why.
Tips?
Ideas?
Explanations?

rafa.ferreira
- 1,997
- 7
- 26
- 41
10
votes
3 answers
Persistent and transient objects - confused about terminology
Here is my definition of the two terms, though I'm not sure if it is a complete one:
A persistent object is an instance of a class in the domain model
that represents some information extracted from the database. A
transient object is an…

user1483278
- 929
- 1
- 9
- 17