transient

Core Data Transient Calculated Attributes

◇◆丶佛笑我妖孽 提交于 2019-12-04 11:50:01
问题 I have an entity that contains lastName and firstName attributes. For reasons beyond the scope of this question, I want a fullName attribute that gets calculated as a concatenation of firstName + space + lastName. Because this is purely a calculated value, with no need for redo/undo or any other of the more sophisticated aspects of transient attributes (merging, etc.), my gut tells me to just override the getter method to return said calculated value. Reading suggests that, if I do this, my

Transient REST Representations

扶醉桌前 提交于 2019-12-04 10:09:44
Let's say I have a RESTful, hypertext-driven service that models an ice cream store. To help manage my store better, I want to be able to display a daily report listing quantity and dollar value of each kind of ice cream sold. It seems like this reporting capability could be exposed as a resource called DailyReport. A DailyReport can be generated quickly, and there doesn't seem to be any advantage to actually storing reports on the server. I only want a DailyReport for some days, other days I don't care about getting a DailyReport. Furthermore, storing DailyReports on the server would

Can properties mapped in hbm.xml be transient?

天涯浪子 提交于 2019-12-04 08:34:15
Suppose I have a User entity like this: class User { private String login; transient private String hashedPassword; } I don't want to ever transfer hashedPassword to clients, so I make it transient. This class is mapped by Hibernate, with both fields mapped in hbm.xml. Is this implementation safe and correct? Will Hibernate correctly store hashedPassword in database, load it into objects from database, keep it in replicated 2nd level cache and local session cache etc? In order words, does Hibernate or 2nd level cache respect transient in any way or completely ignore it? EDIT : I already got

ManagedProperty of SessionScope inside a ViewScoped Bean - Transient?

给你一囗甜甜゛ 提交于 2019-12-04 07:22:00
I have a JSF Beans structure of this sort: @ManagedBean @ViewScoped public class ViewBeany implements Serializable { .... @ManagedProperty(value='#{sessionBeany}) transient private SessionBeany sessionBeany; ... public getSessionBeany() { ... }; public setSessionBeany(SessionBeany sessionBeany) { ... }; } The reason for the transient is that the session bean has some non-Serializable members and cannot be made Serializable. Will this work? If not, How can I solve the problem of not being able to serialize SesionBeany but having to keep it as a managed property under a view scoped bean? Thanks!

What is the use of transient variables? [duplicate]

本小妞迷上赌 提交于 2019-12-03 21:56:40
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Why does Java have transient variables? The transient keyword will be used to prevent serialization of a particular variable. But why should we not to serialize the data? Is there any inner security? 回答1: Some classes are inherently not serializable, because they represent resources outside of the manage Java environment. For example a FileOutputStream can't really be serialized, because it represents an open

Should I leave the variable as transient?

拥有回忆 提交于 2019-12-03 17:18:37
I have been experimenting with Apache Spark trying to solve some queries like top-k, skyline etc. I have made a wrapper which encloses SparkConf and JavaSparkContext named SparkContext . This class also implements serializable but since SparkConf and JavaSparkContext are not serializable then the class isn't either. I have a class solving the topK query named TopK , the class implements serializable but the class also has a SparkContext member variable which is not serializable (for the reason above). Therefore I am getting an exception whenever I try to execute a TopK method from within a

@transient lazy val field serialization

 ̄綄美尐妖づ 提交于 2019-12-03 13:17:39
问题 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 code. object Test { def main(args: Array[String]){ //---------------- // ClassA - with @transient //---------------- val objA1 = ClassA("world"); println(objA1); // This works as expected as follows: // "Good morning." // "Hello, world" saveObject("testA

Difference when serializing a lazy val with or without @transient

Deadly 提交于 2019-12-03 08:51:03
问题 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 = { println("in lazy object") new A(1) } val res = rdd.map(instance.a + _).count() println(res) } compute(sc.makeRDD(1 to 100, 8)) I found that @transient is not necessary here. lazy val can already create the non-serializable upon each task is executed. But

Core Data Transient Calculated Attributes

主宰稳场 提交于 2019-12-03 07:16:16
I have an entity that contains lastName and firstName attributes. For reasons beyond the scope of this question, I want a fullName attribute that gets calculated as a concatenation of firstName + space + lastName. Because this is purely a calculated value, with no need for redo/undo or any other of the more sophisticated aspects of transient attributes (merging, etc.), my gut tells me to just override the getter method to return said calculated value. Reading suggests that, if I do this, my only concern would be whether it's KVO compliant, which I can address by using

Need some help understanding transient properties in Core Data

丶灬走出姿态 提交于 2019-12-03 05:06:46
问题 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 Board : NSManagedObject { NSMutableArray *_grid; } // Core Data to-many relationship @property (nonatomic, retain) NSSet *pieces; @property (nonatomic, readonly) NSArray *grid; -(void)awake; -(void)movePiece:(PieceState *)piece to_x:(int)x y:(int)y