Creating a session bean
For better performance, one of the best practices in developing EJBs is to access entity
beans from session beans. Wrapping an entity bean with a session bean reduces
the number of remote method calls as a session bean may invoke an entity bean
locally. If a client accesses an entity bean directly, each method invocation is a remote
method call and incurs an overhead of additional network resources. We shall use
a stateless session bean, which consumes less resources than a stateful session bean,
to invoke entity bean methods. In this section, we create a session bean in Eclipse.
A stateless session bean class is just a Java class annotated with the @Stateless
annotation. Therefore, we create Java classes for the session bean and session bean
remote interface in Eclipse. To create a Java class, select File | New . In the New
window, select Java | Class and click on Next >
In the New Java Class window, select the Source folder as EJB3JPA/src , EJB3JPA
being the project name. Specify Class Name as CatalogTestBean and click on Finish .