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:
BEA_HOME/wlserver_10.3/samples/server/examples/src/examples/ejb/ejb30/
(where BEA_HOME is the directory containing your WebLogic Server installation)
JSPs that invoke JPA directly |
|
| common_service.jsp | Obtains a EntityManagerFactory reference by direct construction |
| transaction.jsp | Starting a explicit transaction with direct JPA |
| createArtist_service.jsp | Create a new Artist via direct JPA |
| addReview_service.jsp | Adds a new Review via direct JPA |
| showBooks_service.jsp | JPQL queries via direct JPA |
| showSpecificMusic_service.jsp | 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 | Create a new Artist via Session Bean |
| addReview_session.jsp | Adds a new Review via Session Bean |
| showBooks_session.jsp | JPQL queries via Session Bean |
| showSpecificMusic_session.jsp | JPQL queries with predicate via Session Bean |
| addBooks_session_ejb21.jsp | Add 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 | Defines persistent and abstract Item EJB. A root of inheritance hierarchy with SINGLE_TABLE mapping |
| Book.java | Defines persistent Book EJB |
| Music.java | Defines persistent Music EJB |
| Movie.java | Defines persistent Movie EJB |
| Person.java | Defines persistent Person EJB. Another root of inheritance hierarchy with different mapping strategy |
| Artist.java | Defines persistent Artist EJB |
| Reviewer.java | Defines persistent Reviewer EJB |
| Review.java | Defines 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 | A stateless Session Bean that implements a business interface functions on EJB domain model |
| ReviewStatManager.java | Interface defines function calulating the items and reviews added during one session. |
| ReviewStatManagerBean.java | A stateful Session Bean that implements ReviewStatManager interface |
Session Bean with the usage of EJB Reference |
|
| Process.java | Defines a business interface adding reviews on a randomly selected Book. |
| ProcessBean.java | A stateless Session Bean which references EJB ReviewListenerBean to broadcast that a new review is added. |
Message Driven Bean |
|
| WatchProcessMDB.java | A Message Driven Bean invoked when a new review is added. |
| SubscriptionService.java | A POJO is used by the WatchProcessMDB to feed reviews into subscriber. |
| ReviewListener.java | Listener interface for new added reviews. |
| ReviewListenerBean.java | A stateless session bean which send a jms message carring new review's id into exmaple jms queue. |
Application Execeptions |
|
| ObjectExistedException.java | unchecked RuntimeException annoatated as application execption. |
| ObjectNotFoundException.java | unchecked RuntimeException annoatated as application execption. |
| NotLoggedInException.java | Checked Exception. |
| BadCommentsException.java | unchecked RuntimeException annoatated as application execption. |
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 | A 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 | A 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 WebLogic Server examples directory, such as d:\beahome\wlserver_10.3\samples.ant buildant deploy wl_server domain of your 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 WebLogic Server is running
port refers to port on which WebLogic Server is listening
(Internet connection required.)
Copyright @1996, 2008, Oracle and/or its affiliates. All Rights Reserved.