June 2018
Intermediate to advanced
596 pages
12h 39m
English
Business interface for the EJB is a simple Java interface annotated either with @Remote or @Local. Therefore, we can create a local interface for a student bean as follows:
import java.util.List;
import javax.ejb.Local;
@Local
public interface StudentLocal {
public List<Course> getCourses();
}
Furthermore, we can implement a session bean as follows:
import java.util.List;
import javax.ejb.Local;
import javax.ejb.Stateful;
@Stateful
@Local
public class Student implements StudentLocal {
@Override
public List<CourseDTO> getCourses() {
//get courses are return
...
}
}
The client can access the Student EJB only through the local interface:
import javax.ejb.EJB; import javax.faces.bean.ManagedBean; ...
Read now
Unlock full access