Files Prepare Run Troubleshooting Related Topics
This example demonstrates the following features of EJB 3.0:
The example uses a persistent domain model of entity EJBs.
Directory Location:
MW_HOME/wlserver_10.3/samples/server/examples/src/examples/ejb/ejb30/
(where MW_HOME is the directory containing your Oracle WebLogic Server installation)
JSPs that invoke JPA directly |
|
| common_service.jsp | Obtains a EntityManagerFactory reference by direct construction. |
| transaction.jsp | Starts an explicit transaction with direct JPA. |
| createArtist_service.jsp | Creates a new Artist via direct JPA. |
| addReview_service.jsp | Adds a new Review via direct JPA. |
| showBooks_service.jsp | Executes JPQL queries via direct JPA. |
| showSpecificMusic_service.jsp | Executes JPQL queries with predicate via direct JPA. |
JSPs that invoke Session Bean |
|
| common_session.jsp | Obtains a Session Bean injected with a EntityManagerFactory from JNDI. |
| createArtist_session.jsp | Creates a new Artist via Session Bean. |
| addReview_session.jsp | Adds a new Review via Session Bean. |
| showBooks_session.jsp | Executes JPQL queries via Session Bean. |
| showSpecificMusic_session.jsp | Executes JPQL queries with predicate via Session Bean. |
| addBooks_session_ejb21.jsp | Adds a new book via Session Bean with a ejb21 client view. |
| mdb.jsp | Triggers the Message Driven Bean to be invoked. |
Persistent EJBs |
|
| Item.java | Persistent and abstract Item EJB. A root of inheritance hierarchy with SINGLE_TABLE mapping. |
| Book.java | Persistent Book EJB. |
| Music.java | Persistent Music EJB. |
| Movie.java | Persistent Movie EJB. |
| Person.java | Persistent Person EJB. Another root of inheritance hierarchy with different mapping strategy. |
| Artist.java | Persistent Artist EJB. |
| Reviewer.java | Persistent Reviewer EJB. |
| Review.java | Persistent Review EJB. Shows examples of relationship mapping. |
Functions on Persistent EJBs using direct JPA |
|
| PersistenceService.java | Wraps EntityManagerFactory to provide EntityManager per-thread. |
| ReviewService.java | Defines business functions on EJB domain model. |
| ReviewServiceImpl.java | Implements business functions on EJB domain model. |
| SeedDatabase.java | Populates a database with EJB domain model via direct JPA. |
Session Bean on Persistent EJBs injected with EntityManager |
|
| ReviewManagerBean.java | Stateless Session Bean that implements a business interface functions on EJB domain model. |
| ReviewStatManager.java | Interface that defines function calculating the items and reviews added during one session. |
| ReviewStatManagerBean.java | Stateful Session Bean that implements ReviewStatManager interface |
Session Bean with the usage of EJB Reference |
|
| Process.java | Business interface adding reviews on a randomly selected Book. |
| ProcessBean.java | Stateless session bean which references EJB ReviewListenerBean to broadcast that a new review is added. |
Message Driven Bean |
|
| WatchProcessMDB.java | Message-driven bean invoked when a new review is added. |
| SubscriptionService.java | POJO used by the WatchProcessMDB to feed reviews into subscriber. |
| ReviewListener.java | Listener interface for new added reviews. |
| ReviewListenerBean.java | Stateless session bean which send a jms message carring new review's id into exmaple jms queue. |
Application Execeptions |
|
| ObjectExistedException.java | Unchecked RuntimeException annotated as application exception. |
| ObjectNotFoundException.java | Unchecked RuntimeException annotated as application exception. |
| NotLoggedInException.java | Checked exception. |
| BadCommentsException.java | Unchecked RuntimeException annotated as application exception. |
EJB Interceptors |
|
| AuditInterceptor.java | Interceptor class including a business method interceptor methoda and lifecycle callback interceptor method annotated with @PreDestroy. |
| InterceptedProcess.java | Business interface for the EJB interceptor sample. |
| InterceptedProcessBean.java | Stateless session bean annotated with a interceptor to valid comments being added. |
Session Bean with EJB21 client view. |
|
| ItemManager.java | Business interface. |
| ItemManagerHome.java | Home interface. |
| ItemManagerLocal.java | Component interface. |
| ItemManagerBean.java | Stateless session bean annotated with Home and Business interface. |
Deployment Descriptors |
|
| application.xml | Deployment descriptor for the application. |
| web.xml | Deployment descriptor for the web module. |
| persistence.xml | Descriptor for the Persistence Provider Runtime. |
| dwr.xml | Descriptor for Direct Web Remoting. |
| data.properties | Sample data to populate the database. |
Before working with this example:
No special configuration is required for this example
SAMPLES_HOME\server\examples\src\examples\ejb\ejb30
directory, where SAMPLES_HOME refers to the main Oracle WebLogic
Server examples directory, such as d:\Oracle\Middleware\wlserver_10.3\samples.ant buildant deploy wl_server domain of your Oracle WebLogic Server installation.Additional information on using the build scripts is found in More About Building Examples.
ant run http://localhost:port/reviewService/
where
localhost refers to the machine on which Oracle WebLogic Server is running
port refers to port on which Oracle WebLogic Server is listening
(Internet connection required.)
Copyright @1996, 2009, Oracle and/or its affiliates. All Rights Reserved.