Table of Contents

WebSphere EJB 2
Create a J2EE Websphere compatible application
Install Websphere
Setup Data Sources
Create tables in database
Install application
Execute the application

WebSphere EJB 2

NOTE: These instructions only apply if you want to use EJB2 (with CMP); if you use Hibernate or EJB3 JPA you can deploy the war from OpenXava directly in the WebSphere. It's not advisable to use EJB2 for new developments.
OpenXava generates J2EE aplications deployables in IBM Websphere Application Server 5.0, 5.1, 6.0 y 6.1.
Doing this simply requires executing a ant target that generates an EAR compatible with Websphere. Touching your code or XML files is not necessary.
This allows you developing your application using JBoss (hence in an agile way) and when it is ready for production deploy it in Websphere and of course test it.
This document is a guide for deploying an OpenXava application in Websphere. If you does not have one yet it's better that before this guide follow the tutorial of OpenXava, and you will obtain a MySchool.ear.

The next instructions work with Websphere 5.0, 5.1 and 6.0. In the examples you will connect to an AS/400, but is very easy using another database instead.

Create a J2EE Websphere compatible application

Open your Eclipse and make that it point to the workspace that comes with OpenXava distribution.
And now you have in MySchool.dist a file named MySchool.ear ready to deploy in Websphere.

Install Websphere

This step is your own business. Use the IBM instructions about this topic and have luck. Install the last patch level too.

Setup Data Sources

Open the admin console, going to http://localhost:9090/admin (or http://localhost:9060/admin in version 6)
First you have to create a J2C entry, that contains an alias for an user/password that you will use in order to authenticate against your database.
Register your JDBC driver:
Register the Data Source for OpenXava:
Registre the Data Source for your application:
Verify the Data Sources just defined:
If message is satisfactory you have concluded well this step.

Create tables in database

Execute the next script against your DB:
CREATE COLLECTION OPENXAVA;
CREATE TABLE OPENXAVA.TABUSERPREFERENCES
    (OID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,
    USER VARCHAR(20),
    TAB VARCHAR(100),
    PROPERTIESNAMES VARCHAR(512));
CREATE INDEX OPENXAVA.TABUSERPREFERENCES01
    ON OPENXAVA.TABUSERPREFERENCES(USER,TAB);
 
CREATE COLLECTION MYSCHOOL;
CREATE TABLE MYSCHOOL.TEACHER(ID VARCHAR(5) NOT NULL PRIMARY KEY,NAME VARCHAR(40));
CREATE TABLE MYSCHOOL.PUPIL(NUMBER INTEGER NOT NULL PRIMARY KEY,NAME VARCHAR(40),TEACHER VARCHAR(5));
INSERT INTO MYSCHOOL.TEACHER VALUES('JP','FRANCISCO JAVIER PANIZA LUCAS');
INSERT INTO MYSCHOOL.TEACHER VALUES('MC','M. CARMEN GIMENO ALABAU');
INSERT INTO MYSCHOOL.PUPIL VALUES(1,'LARS',NULL);
INSERT INTO MYSCHOOL.PUPIL VALUES(2,'ANA','JP');
INSERT INTO MYSCHOOL.PUPIL VALUES(3,'LUIS MIGUEL','JP');
INSERT INTO MYSCHOOL.PUPIL VALUES(4,'MIGUEL',NULL);

Install application

In order to install your application you have to do:

Execute the application

Now everything is ready to execute you application in Websphere:
Also you can execute your JUnit Test, in your Eclipse: