Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The customere sample is a very simple demonstration of a container managed jpa persistence context accessed from a stateless session bean, in turn accessed from a jsp based web app or standalone java client. Since jsps do no support dependency injection through annotations the ejb is looked up in an auxiliary class using the "legacy" java:comp/env jndi context.

JPA details

There is a single Customer entity called CustomerInfo. It CustomerInfo.java is the entity bean that represents the Customer table in the database. By using @Entity, @Table(name = "customer"), and @Id it tells OpenEJB that this is an entity bean, which is representative of the table "customer" and has "customerId" as the primary key. By using these annotations no other configuration is needed inside openejb-jar.xml CustomerInfo.java includes 2 named queries, one is called AllCustomers; the other is called FindCustmer.

...