Java Reference
In-Depth Information
Similarly, create a
CatalogTestBeanRemote
interface by selecting
Java
|
Interface
in
the
New
window. The session bean class and the remote interface get added to the
EJB3JPA
project.
The session bean class
The stateless session bean class,
CatalogTestBean
implements the
CatalogTestRemote
interface. We shall use the
EntityManager
API to create,
find, query, and remove entity instances. Inject an
EntityManager
using
the
@PersistenceContext
annotation. Specify
unitName
as the same as the
persistence-unit
name in the
persistence.xml
configuration file:
@PersistenceContext(unitName = "em")
EntityManager em;
Search WWH ::
Custom Search