I have an entity with an transient attribute, and it's optional flag is set to NO. If I fetch an instance of this entity from persistent store, change something and save back, need I set this transient attribute ?
+1
A:
Transient values are not saved at all so optional or required has no effect on them.
Update:
Okay, I got that completely wrong. I am in the habit of setting default values and/or my transients always have calculated values so I'd forgotten that required transients do have to have a value. I tested it make sure.
If you have a transient attributes without values and its required the logic of the app should enforce that. Since you don't seem to use the transient every time, I suggest setting a default value or calculating the value in a custom getter method.
TechZen
2010-08-23 12:08:10
but in my test, save will fail if leave required transient attribute nil.
gwang
2010-08-24 01:29:28
Yes, I got that wrong. See the update.
TechZen
2010-08-24 14:02:34
thank you. I also found that setting default value is a good way
gwang
2010-08-25 02:04:22