EJB3 Examples
All examples come with JUnit unit tests that can be run in any IDE, Maven or Ant without special plugins using OpenEJB as an embedded EJB container. The easiest way to run the examples in your IDE is to use maven (mvn eclipse:eclipse
or mvn idea:idea
) to generate project descriptors.
title |
description |
APIs used |
---|---|---|
Unknown macro: {div} |
Simple EJB3 @Stateless bean with local and remote business interfaces and unit test. |
|
Simple EJB3 @Stateful bean with local and remote business interfaces and unit test. |
|
|
Shows an EJB 3.0 Stateful bean with Business interfaces and EJB 2.1 interfaces (now called "component" interfaces) using the @LocalHome and @RemoteHome. Four interfaces in total. |
|
|
Shows how @Resource can be used to inject |
|
|
Same as the above example but shows how to use a properties file to declare the injection values and demonstrates how to get injection of more types such as java.util.Date, java.lang.Class, java.net.URI and more. OpenEJB specific feature. |
|
|
Shows use of @EJB in a Stateless to have another Stateless bean injected into it. |
|
|
Shows use of @Resource to have a JDBC DataSource injected into a Stateful bean. The Stateful bean does basic INSERT, SELECT and DELETE SQL operations. |
|
|
Shows use of @Resource to have an EntityManager with an EXTENDED persistence context injected into a Stateful. An EJB 3 @Entity bean is with the EntityManager to create, persist and merge data to a database. |
|
|
Shows several EJB 3 Interceptors with @AroundInvoke methods intercepting invocations on a Stateless bean. |
|
|
Demonstrates how to use an OpenEJB feature that allows people embedding OpenEJB into their applications to support remote clients in other VMs. This is not required for unit testing. |
|
|
Demonstrates OpenEJBs ability to understand and support the WebLogic deployment descriptors so people using that platform in production can still use OpenEJB in their IDE or build to unit test their EJB applications. |
|
|