Save and restore: enterprise beans
The following items should be considered for backup when using enterprise beans:
- Database data
- EJB source code, class files, and deployed code
- Administrative configuration
Database data:
Enterprise beans often use a database for back-end persistence. Container-managed entity beans always use a database for back-end persistence. This data should be backed up the same as any of your business data.
The collection for container-managed entity beans persistence is determined by either the schema name specified during deployment, or the schema specified on the data source associated with the enterprise bean. Any persistent store used by session and bean-managed beans is defined by the bean implementation. For database tables, you can choose to save the entire collection or an individual table as shown with the following commands, respectively:
SAVLIB LIB(EJB) DEV(*SAVF) SAVF(WSALIB/WSASAVF) SAVOBJ OBJ(MYBEANTBL) LIB(EJB) DEV(*SAVF) OBJTYPE(*FILE) SAVF(WSALIB/WSASAVF)It may be possible to save database objects while WebSphere Application Server is active, if the save operation can obtain a snapshot of the data store. You may have to shut down if a snapshot cannot be obtained. This would occur if there are requests that obtain locks or have open transactions against the database being saved. See the Backup and Recovery Guide for more information by selecting the Backup, Recovery, and Availability link in the iSeries Information Center.
EJB source code, class files, and deployed code:
When you deploy enterprise beans, a WebSphere Application Server-specific implementation of the enterprise beans is generated. You should save these deployed Java(TM) Archive (JAR) files to avoid redeploying, and to preserve any binding information that was specified during the application installation. The JAR files, application code and configuration (such as bindings) are located by default in the /QIBM/UserData/WebAS5/Base/instanceName/installedApps directory. By saving this directory, you save your installed applications, including HTML, servlets, JavaServer Pages(TM) (JSP(TM)) files, and enterprise beans. Normally, each application is located in a separate subdirectory, so you can choose to save all applications or a subset.
Note: The commands below have been wrapped for display purposes. Enter each as a single command.
This command saves all installed applications:
SAV DEV('/QSYS.lib/wsalib.lib/wsasavf.file') OBJ(('/QIBM/UserData/WebAS5/Base/instance/installedApps'))This command saves the sampleApp application only:
SAV DEV('/QSYS.lib/wsalib.lib/wsasavf.file') OBJ(('/QIBM/UserData/WebAS5/Base/instance/installedApps/cellName/sampleApp.ear'))If you have located utility or general purpose classes in other directories, such as /QIBM/UserData/WebAS5/Base/instance/lib/app or /QIBM/UserData/WebAS5/Base/instance/lib/ext, be sure to include those locations in your backup plan as well.