Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

The Phone Book Bean Example

...

And, as usual there is an empty constructor for the Entity Bean

...

MyPhonebookLocal.java is the business interface that drives the above mentioned Entity Bean.

...

MyPhonebookBean.java is where the implementation of the local (and if there is, a the remote) interface exists. To explain what the annotations in this Stateless Session Bean means I will enumerate them:

  1. @Stateless - tells Geronimo that this is a stateless session bean
  2. @PersistenceUnit - tells Geronimo to retrieve a persistence unit defined in the persistence.xml and place it in the EntityManagerFactory

    Note

    Note that PersistenceContext is used when you are directly obtaining a EntityManager. For an EntityManagerFactory use PersistenceUnit.

...

index.jsp is the JSP page that uses the EJB to access the database.

...

...

Deployment Plans

persistence.xml will specify the name of the PersistenceUnit. This name is used when referencing for the EntityManagerFactory. I have denoted it as PhonePU. I added an extra property called SynchronizeMappings so that the data in the database will not be overwritten.

...

Deployment Plan for the Application

plan.xml is generated by building the sample and can be found under ./myphonebook-jetty/target/resources/META-INF/plan.xml to deploy on jetty or ./myphonebook-tomcat/target/resources/META-INF/plan.xml to deploy on tomcat following a successful build of the sample. Shown below is the deployment plan for tomcat.

...

Building, Configuring, and Deploying the Application

...