Deploying a CMP Entity Bean

The enterprise application can be deployed either from the command line (deploy script in the build directory) or using deploytool itself.

However, before an enterprise application containing CMP Entity beans can be deployed, the default SQL must be generated by using the Deployment Settings dialog box. This is performed once for each CMP Entity bean, as shown in Figure 7.13.

Figure 7.13. deploytool allows SQL to create the database schema to be generated.


You can see from the figure that J2EE RI generates default SQL. It allows the SQL query for the finder and select methods to be tuned, and also (the container methods radio button) allows the actual SQL to create the tables, insert rows, and so on to be modified also. The case study does not change any of this default SQL.

Note

Right at the beginning of today's chapter, it was noted that the schema of the database for the case study had changed from that of Day 6. If one wanted to use the exact schema from Day 6, it could have been entered here.


Also, the dialog allows the underlying tables to be created and deleted on deploy/undeploy. This obviously isn't appropriate for a production environment, because it would delete any data already there. It also is not appropriate for the case study, because there is example data.

Note

The CreateCMPAgency script (provided in the day07Database directory) creates exactly the same schema as that generated by default by J2EE RI. It also populates that schema with the same data as in Day 6 and creates views for backwards compatibility.


You will recall that the auxiliary deployment descriptor agency_ea-sun-j2ee-ri.xml contains all the mappings of the logical dependencies of the EJBs to the physical runtime environment. This includes all of the SQL specified in Figure 7.13.

It was noted earlier that when creating a new CMP Entity bean, it is often easiest to load the enterprise application into deploytool and then save the XML deployment descriptor using the Tools, Descriptor Viewer menu option/dialog. Unfortunately, deploytool does not provide any easy way to write out the auxiliary deployment descriptor, and it is required for the command line approach. The buildAll script calls the addJ2eeRiToEar script that does precisely this.

The only real option is to save the agency.ear file once modified, and then use a tool, such as WinZip, to load up the EAR file. The auxiliary deployment descriptor can be extracted from that.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.241.250