Define the Glossary entity bean

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.

StepsCreating the entity bean classes

  1. Under the EAServer java/classes directory, create the following subdirectory structure:

    Sample/Intro/Glossary
    
  2. 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.

  3. 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
    

StepsImporting the entity bean classes into EAServer Manager

  1. In EAServer Manager, click on the Tutorial package.

  2. Select File | New Component.

  3. In the Component wizard, select Import From EJB Class File. Click Next.

  4. In the Component wizard - CLASSPATH screen, click Next. No changes are required to the default CLASSPATH to import our classes.

  5. In the Component wizard - Import EJB Class Files screen, enter the values below:

    Field

    Value

    Component Name

    Glossary

    Component Type

    JaguarEJB::EntityBean

    Bean Class

    Sample.Intro.Glossary.GlossaryBean

    Primary Key Class

    java.lang.String

    Specify Remote Interface

    (Checked)

    Home Interface Class

    Sample.Intro.Glossary.GlossaryHome

    Remote Interface Class

    Sample.Intro.Glossary.Glossary

    Specify Local Interfaces

    (Not checked)

  6. Click Finish. You see a dialog saying “All methods imported,” then the Component Properties dialog box displays.

  7. Apply or confirm the following settings to the General tab fields in the Component Properties dialog box:

    Field

    Value

    Description

    Tutorial EJB entity bean

    Component Type

    EJB - Entity Bean

    EJB Version

    2.0

    JNDI Name

    Tutorial/Glossary

    Leave other fields as-is, and click OK.