This project contains a parolee web service identical to Example 11, except that it uses JPA / Hibernate to persist its state.
You can see how the ParoleeResource
class uses EntityManager
and various query / update operations. You can also see the use of various JPA annotations in the domain model.
In addition, in ParoleeApplication
, you can see we're supplying the ParoleeResource
class, rather than an instance of that class as we did before. This is because the application state is no longer contained within ParoleeResource
, but is within the database. Therefore, we can allow JAX-RS to create new instances of ParoleeResource
as required, to provide better multithreading performance.