(Documentation) Using Dependency Injection In Web Module
Documentation : Using Dependency Injection In Web Module
Introduction
This example application demonstrates Oracle's support for the Servlet 2.5 annotations and EJB 3.0 specification. It provides an example of using the new EJB 3.0 components from a Web application.
OC4J supports the following annotations in the web container:
- JSR 250 common annotations
- javax.ejb.EJB annotation as defined by EJB 3.0 specification
- javax.persistence.PersistenceContext and javax.persistence.PersistenceUnit as defined by EJB 3.0 Java Persistence API.
- javax.xml.ws.WebserviceRef as defined by Java XML Web services 2.0
It also supports the corresponding XML elements in the web module deployment descriptor.
This demonstration uses the Employee entity to demonstrate a entity using EJB 3.0 JPA that is accessed by the web module using EmployeFacade session bean.
Entity example using EJB 3.0
The bean class is a plain java class that is annotated with @Entity to mark it as an entity bean.
@Entity
@Table(name = "EMP")
public class Employee implements java.io.Serializable
{
private int empNo;
private String eName;
private double sal;
@Id
@Column(name="EMPNO")
public int getEmpNo()
{
return empNo;
}
..
}
Courtesy:- Oracle.com
- guru's blog
- Login to post comments
