4. Working with Classes : How You Can Create a User Class : Examples of Method: Hire Method
 
Share this page                  
Examples of Method: Hire Method
The following sections describe the Hire method as it is defined for the Employee class and the TempEmployee, PermanentEmployee, and Manager subclasses.
Each of these methods handles error checking, which performs a rollback if the database access fails. A failure at the bottom of the hierarchy causes rollbacks in every method previously invoked by the SendSuperclass method.
Note:  No commit statements are issued in these methods to allow for future additions to the user class hierarchy. Adding a new subclass whose method includes additional SQL statements as part of the same transaction would force a revision of all superseded methods containing a commit statement.
These methods assume that the programmer handles all commits. For consistency, the rollback statements could alternatively be handled by individual programmers and removed from the method scripts.