Deploy Ejb On Websphere

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Deploy Ejb On Websphere as PDF for free.

More details

  • Words: 1,048
  • Pages: 4
Readme for Bank Example This example illustrates CMP entity beans built using single table inheritance. It creates VapBankTransaction, VapAccount, etc by mapping to single tables, TPF.BANKXACT, TPF.ACCOUNT, respectively, within the database, BankSample. In addition, the Bank example includes a many-to-many relationship between VapBankBranch and VapCurrency using VapBranchToCurrency and defines a custom composer for name (an entity field for VapCustomer). Finally, finders are employed to find all instances of the persistent objects. NOTE: This example is generated by the Export Tool for Enterprise Java Beans 1.1 version 1.0 from IBM VisualAge for Java version 4.0. Multiple warnings are displayed in the Task View regarding deprecated java classes and return types must be serializable.

Contents This example includes eleven EJBs which demonstrate the following relevance:

1. VapBankTransaction 2. VapAccount 3. VapCustomer 4. VapDeposit 5. VapCurrency 6. VapWithdrawal 7. VapAddress 8. VapBankBranch 9. VapBranchToCurrency 10. VapCheckingAccount 11. VapSavingsAccount After creating the example project for the Bank example, double-click the BankSampleEJBGroup within the EJB Modules of the J2EE View to open it in the EJB editor. This is the editor from which these beans were created and can be edited. Next, open BankSampleEJBGroup using the EJB Extension Editor to view the bean inheritance, relationships, finders, and set their datasource bindings. In preparation for running the example, generate an EJB to RDB mapping, its schema DDL, deploy and RMIC code, and export its schema to a database. Finally, a WebSphere Test Environment can be created and the Bank enterprise beans can be tested in the EJB test client. To run the Bank example, follow these steps:

Generating EJB code: 1. From the J2EE View, select EJB Modules/BankSampleEJBGroup > Open In EJB 2. 3. 4. 5. 6. 7.

Extension Editor from the pop-up menu. Click on the Binding tab. Click on BankSampleEJBGroup. Datasource: JNDI name: jdbc/sample. From the File menu, select Save EJB Extension Editor. From the File menu, select Close. From the J2EE View, select EJB Modules/BankSampleEJBGroup > Generate > Deploy and RMIC code from the pop-up menu.

8. Click Select all. 9. Click Finish.

Setting up the database: 1. If you do not already have the Bank tables in your SAMPLE DB2 database in DB2 then you will need to run the schema Table.ddl file. From the J2EE View, select EJB Modules/BankSampleEJBGroup > Generate > Schema DDL from the pop-up menu. 2. In the Navigator view, select BankExample/ejbModule/META-INF/Schema/Table.ddl > Open With > SQL Editor from the pop-up menu. 3. Add the following command at the top of the file and save it: CONNECT TO SAMPLE;

4. From a command prompt execute: cd \eclipse\workspace\BankExample\ejbModule\META-INF db2cmd.exe -c -i -w db2 -tf table.ddl

Enabling JDBC 2.0 on DB2: If you have not already enabled JDBC 2.0 on DB2 then you will need to run the usejdbc2.bat file.

1. Stop all DB2 processes. 2. From a command prompt run the usejdbc2 batch file in 3.

DB2_INSTALL_PATH\SQLLIB\java12,. where DB2_INSTALL_PATH is the path where you installed DB2. Reboot your system and restart DB2.

Important: If you are denied access when running the usejdbc2.bat file, you have not stopped all of the DB2 processes.

Setting up a server instance and configuration: [HINT: Immediately after completing step 1, below, you will need to reopen this README file. To do this, go to the Navigator view and use the pop-up menu to select BankExample/ejbModule/README.htm > Open With > Web Browser.]

1. From the Perspective menu, select Open > Server. 2. From the File menu, select New > Server Instance and Configuration. Type or select the following values: o Server name: Server for Bank o Server project folder: BankSRV o Server instance type: WebSphere Servers/WebSphere v4.0 Test Environment o Templates: None

3. Click Finish. 4. From the Server Configuration view, select Server Configurations/Server for Bank/Add Project > DefaultEAR from the pop-up menu.

5. From the Server Configuration view, select Server Configurations/Server for Bank > Open from the pop-up menu.

6. Click on the Datasource tab. In the JDBC Driver List, select Db2JdbcDriver 7. 8. 9.

10. 11. 12.

(COM.ibm.db2.jdbc.DBCConnectionPoolDataSource), then click Edit... Verify the classpath: <path to your install of db2>\SQLLIB\java\db2java.zip Click OK. In the Datasources defined for the JDBC driver selected above, click Add... Type or select the following values: o Name: Sample Database o JNDI name: jdbc/sample o Database name: SAMPLE Click OK. From the File menu, select Save Server for Bank. From the File menu, select Close.

Running on the Unit Test Client: 1. From the Navigator view, select BankExample > Run on Server. 2. Click on the JNDI Explorer to find the Home interface for the Bank beans and start creating and manipulating the Bank example enterprise beans. You can use tools shipped with your database to verify the persistence of your newly created beans by inspecting the contents of the database tables.

Documentation For detailed information on the topics illustrated by the Bank example, please refer to documentation contained in the following sections of the online help: • • • • • • • • • • • • •

Developing enterprise beans - overview Implementing custom finder helpers for CMP entity beans Adding methods to the home and remote interfaces Adding and Editing CMP fields Generating a top-down mapping Creating and editing relationships (associations) Setting EJB deployment descriptor properties Generating EJB deployment code from the workbench Creating or editing EJB access beans Testing EJB projects - overview Creating a server instance and configuration (together) Setting a server instance to use a server configuration Adding a project to a server configuration

• •

Starting server instance Using the EJB test client

Limitations The only additional prerequisite needed to exercise the Bank example is a jdbc database. The rest of this document assumes that you have DB2 installed and a working SAMPLE database. // DISCLAIMER: // The following [enclosed] code is sample code created by IBM // Corporation. This sample code is not part of any standard IBM product // and is provided to you solely for the purpose of assisting you in the // development of your applications. The code is provided 'AS IS', // without warranty or condition of any kind. IBM shall not be liable for any damages // arising out of your use of the sample code, even if IBM has been // advised of the possibility of such damages.

Related Documents

Deploy Ejb On Websphere
November 2019 9
Ejb
November 2019 25
Ejb
May 2020 13
Ejb
May 2020 11
Ejb
November 2019 22