Java Reference
In-Depth Information
Listing 23-1: A persistent class — Yacht
package java_database.jdo;
public class Yacht {
private String yachtName;
private String builder;
private String engineType;
private int capacity;
private int maxVelocity;
/** constructor */
public Yacht(String yachtName, String builder, String engineType,
int capacity, int maxVelocity) {
this.yachtName = yachtName;
this.builder = builder;
this.engineType = engineType;
this.capacity = capacity;
this.maxVelocity = maxVelocity;
}
/** default constructor */
public Yacht() { }
// getters and setters
public String getYachtName() { return yachtName; }
public String getBuilder() { return builder; }
public String getEngineType() { return engineType; }
public int getCapacity() { return capacity; }
public int getMaxVelocity() { return maxVelocity; }
public void setYachtName(String v) { yachtName = v; }
public void setBuilder(String v) { builder = v; }
public void setEngineType(String v) { engineType = v; }
public void setCapacity(int v) { capacity = v; }
public void setmaxVelocity(int v) { maxVelocity = v; }
}
All these features — transparent persistence; extended query capability; adherence to the object-
oriented paradigm and support for the complex data model; simplicity; and so on — make the JDO a
unique persistent mechanism and should be in every enterprise application developer's toolkit. Table
23-1 summarizes the features of the persistence mechanisms discussed in this section. You learn the
details of JDO in the next section .
Search WWH ::




Custom Search