We will define the entity bean by first creating the bean interface and implementation classes in Java, then importing the classes into EAServer Manager. Importing the classes creates the EJB component and defines the IDL interfaces required for it to run in Jaguar and be invoked by clients.
Creating the entity bean classes
Under the EAServer java/classes directory, create the following subdirectory structure:
Sample/Intro/Glossary
Copy the following files from the html/docs/tutorial/ejb directory of your installation to the java/classes/Sample/Intro/Glossary directory:
Glossary.java defines the remote interface.
GlossaryHome.java defines the home interface.
GlossaryBean.java contains the source for the implementation.
Compile these classes using a JDK 1.3 or later compiler, for example, on UNIX:
cd $JAGUAR/java/classes/Sample/Intro/Glossary $JAGUAR/bin/jc Glossary*.java
Or on Windows, in a Command window:
cd %JAGUAR\java\classes\Sample\Intro\Glossary %JAGUAR%\bin\jc Glossary*.java
Importing the entity bean classes into EAServer Manager
In EAServer Manager, click on the Tutorial package.
Select File | New Component.
In the Component wizard, select Import From EJB Class File. Click Next.
In the Component wizard - CLASSPATH screen, click Next. No changes are required to the default CLASSPATH to import our classes.
In the Component wizard - Import EJB Class Files screen, enter the values below:
Field |
Value |
---|---|
Component Name |
|
Component Type |
JaguarEJB::EntityBean |
Bean Class |
|
Primary Key Class |
|
Specify Remote Interface |
(Checked) |
Home Interface Class |
|
Remote Interface Class |
|
Specify Local Interfaces |
(Not checked) |
Click Finish. You see a dialog saying “All methods imported,” then the Component Properties dialog box displays.
Apply or confirm the following settings to the General tab fields in the Component Properties dialog box:
Field |
Value |
---|---|
Description |
|
Component Type |
EJB - Entity Bean |
EJB Version |
2.0 |
JNDI Name |
|
Leave other fields as-is, and click OK.
Copyright © 2005. Sybase Inc. All rights reserved. |