We are presented with three options:
• Generate a subclass of javax.ws.rs.core.Application
• Do nothing, then manually write some code or coniguration to register
• Generate a web.xml deployment descriptor with the appropriate
In most cases we want to pick the first option since one of the major benefits of
Java EE 6 over previous versions is reduced reliance on configuration files such as
web.xml . The do nothing option requires us to manually configure our RESTful
web services, and the web.xml option uses the older way of configuring JAX-RS
via this deployment descriptor.
In most cases, the Add Jersey Library (JAX-RS reference implementation)
to project classpath checkbox should be checked, since this option auto-
matically adds the required JAX-RS libraries to our project.
Analyzing the generated code
The wizard discussed in the previous section creates a JPA entity for each chosen
table, plus an AbstratFacade class and a Facade class for each generated JPA entity.
The generated code follows the Facade design pattern, in essence, each Facade class
is a wrapper for JPA code.
See http://en.wikipedia.org/wiki/Facade_pattern for more
information on the Facade design pattern.