Multiple Mapping Back-end Support





Multiple Mapping Back-end Support

We first touched on the mapping back-end support when we were describing the EJB to RDB mapping wizard. The first page of this wizard (Figure) provided options for creating a back-end folder or using an existing back-end folder when creating or making changes to the map file. When we created the top-down mapping for our TimeSheetGroup EJB module a new back-end folder was created based on the type of the database. Since we first mapped to a DB2 8.1 database, a back-end folder was created with the name DB2UDBNT_V81_1. The last number will be incremented if we create another back-end mapping to the same database type. Figure shows the TimeSheetGroup EJB project structure within the J2EE Navigator provided with WSAD. Notice that the location of all back-end folders will be within the META-INF/back-end folder.

19. Back-end folder structure.

graphics/24fig19.jpg

At this point you are probably asking what it means to have multiple back-end folders. Whenever you generate the deploy code for an EJB project that contains multiple back-end folders, deploy code is created for each back-end folder. For example, you might find it convenient to use DB2 UDB as a back-end for unit testing, while your target production environment is DB2 zOS. You can create a back-end mapping for both and have the deployed code generated for both at the same time. This means that the deploy code would be exported to the EJB JAR file during export. That means that a JAR can be deployed once and run against many different database environments.

Only one back end is used by a running application server. Determining which one to use is accomplished by setting the current back end within the EJB deployment descriptor editor. When you open the EJB deployment descriptor editor, scroll to the bottom of the Overview page. Here you will see the Backend ID section as part of the larger WebSphere bindings section (shown in Figure). The drop-down box in this section will contain an entry for each back end that has been created for the project. The current back end will be set automatically during deploy code generation if it has not already been set.

20. Current back-end section.

graphics/24fig20.gif


     Python   SQL   Java   php   Perl 
     game development   web development   internet   *nix   graphics   hardware 
     telecommunications   C++ 
     Flash   Active Directory   Windows