Schematic for creating 3-tier JSF/JPA application in Eclipse

JPA Layer:
1. Make project

2. Make DB connection

3. Convert project to JPA project — use connection from step 2

4. Make JPA entities – give them properties
4a List them as “managed” in persistence.xml

5. Make tables

EJB (business logic) Layer:
1. Make EJB classes that manipulate JPA entities in JPA layer.

2. Annotate EJB classes as:
EntityManager em;

3. Give the EJB classes methods to be called from the View layer

View Layer (Web, specifically)
0. If faces-config.xml doesn’t exist, do Project Properties->JPA
->Project Facets

1. In faces-config.xml, make new Managed Bean classes. Give them
Session scope.

2. Annotate them with:
BookEJB bookEJB; // for example

3. Put properties in the managed bean classes that will be
bound to the fields in the web pages.

4. Make methods in the managed bean classes that will be bound to
the buttons/links etc. in the web pages. The methods should return
strings that tell the JSF engine which page to load next.

5. Make xhtml file(s). Be sure to put the following before the
Order matters.

6. Make a form. Put components in the form that are bound to the
managed bean class properties.

Installing Oracle Java on Ubuntu – summary

Each time I do this, I have to search the Web to remember where the PPA is and what packages to install, so this time I’m summarizing the steps here:

  1. Add the WebUpd8Team Java PPA:
    sudo add-apt-repository ppa:webupd8team/java
  2. Install the installer package (downloads the Oracle installer from Oracle’s repository):
    sudo apt-get update
    sudo apt-get install oracle-java7-installer
  3. To set up required environment variables:
    sudo apt-get install oracle-java7-set-default

For details and troubleshooting tips, see: