Title: Spring EJB and JPA {note}OpenEJB 3.1 or later required{note} This example shows how to combine Spring, OpenEJB and Hibernate using the integration code provided by OpenEJB. Here, OpenEJB is used as an embeddable EJB container inside of Spring. See the [Spring](spring.html) page for details. We use the basic Movie example and expand it to include more objects to demonstrate both Spring beans, EJB Session beans, and JPA persistent objects in one application. The premise of the example is a Cineplex that has a number of Theaters (viewing screens), each playing a number of Movies. The basic object layout is as follows:
Object | Type | Description |
---|---|---|
[CineplexImpl](http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration/src/main/java/org/superbiz/spring/CineplexImpl.java) | @Stateless | Shows the use of @Resource to have Spring beans injected. Specifically, the _Theaters_ Spring bean |
[Theaters](http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration/src/main/java/org/superbiz/spring/Theaters.java) | Spring bean | Simple wrapper object injected into _CineplexImpl_ |
[Theater](http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration/src/main/java/org/superbiz/spring/Theater.java) | Spring bean | Shows that EJBs can be injected into Spring beans. Uses both the _Movies_ EJB and the _Movie_ JPA objects |
[MoviesImpl](http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration/src/main/java/org/superbiz/spring/MoviesImpl.java) | @Stateful | Wraps a JPA EntityManager and provides transactional access to the persistent _Movie_ objects |
[Movie](http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration/src/main/java/org/superbiz/spring/Movie.java) | @Entity | Basic JPA bean that is used both by Spring beans and EJBs. The same _Movie_ object as in all the other persistence related examples. |
[AvailableMovies](http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration/src/main/java/org/superbiz/spring/AvailableMovies.java) | Spring bean | Simple object used as a clever way to seed the EntityManager (and really, the database) with persistent _Movie_ objects |