Persistence in Object Oriented languages

Figure 774. Persistence [Bauer2015] Slide presentation Create comment in forum

Persistence allows an object to outlive the process that created it. The state of the object may be stored to disk and an object with the same state re-created at some point in the future.


Figure 775. Java transient instances Slide presentation Create comment in forum
public class User {
  String commonName; // Common name e.g. 'Joe Bix'
  String uid;        // Unique login name e.g. 'bix'
  ...// getters, setters and other stuff

}
//------------------------------------
// Thread lifespan (transient instance)
User u = new User("Joe Bix", "bix");

Figure 776. RDBMS persistent records Slide presentation Create comment in forum
CREATE TABLE User(
  CHAR(80) commonName
 ,CHAR(10) uid PRIMARY KEY
);
-- Persistent record (see Durability in ACID)
INSERT INTO User VALUES('Joe Bix', 'bix');

Figure 777. Persisting transient User instances Slide presentation Create comment in forum
Persisting transient User instances

Figure 778. Observations Slide presentation Create comment in forum
  • Processes in disjoint address spaces:

    1. JRE™ runtime.

    2. RDBMS server.

  • Multiple runtimes possible (PHP)

  • save and load denote communications across OS boundaries.