Exposing RESTful Services through JAX-RS
At this point we need to create a Stateless Session Bean (EJB) that will query exhibition data through the JPA entities and return such information. Before getting into it, let's take a quick look at the types of beans supported by Java EE 6 and their definitions:
Stateless: This is the same definition we find for EJB 2.x—components that aren't supposed to keep information between calls. The container keeps a bean pool, and any bean instance can serve an incoming request, being very lightweight to keep and having good scalability due to its ability to serve multiple clients.
Stateful: When multiple interactions between system and user is needed, this kind of bean keeps consistent state through the conversation. As it holds data from a specific user, more instances have to be created to serve more users. Under heavy loads, it can degrade performance.
Message-driven: The focus of this kind of bean is asynchronous processing—instead of calling its methods...