Java Reference
In-Depth Information
Figure 10-13.
If the Employee table is moved to the Oracle DBMS, all a Java programmer would have to change is the Employee
header to extend the OracleDB class as follows:
public class Employee extends OracleDB{...
And, as you probably guessed, if the Employee table were moved to the Access DBMS, the Employee header
would be changed to:
public class Employee extends AccessDB{...
Because we specified the DBMS information in separate classes (e.g., OracleDB, AccessDB) rather than in the
“table classes” (e.g., Employee) and built a superclass/subclass relationships (so that the required objects, methods,
and variables are inherited), physical changes to table locations have a minimal impact on the Java classes. In
addition, if the DBMS was moved to a different host or a password was changed, only the DBMS classes (containing
the URL address and password) would need to be changed. Even if the Java technology for accessing a database
changed (e.g., connection objects were replaced), only the DB class' init method would be affected.
A great deal of the advances in Java (Java Server Faces (JSFs), Enterprise Java Beans (EJBs), etc.) are in the area of
working with databases. In the next chapters, we will examine some of these new technologies.
Search WWH ::




Custom Search