DNA: Do-Nothing Application


DNA application is used to demonstrate JEST.
DNA application is deployed as a HTTP Servlet.
The servlet creates an OpenJPA persistence unit at initialization.
It does nothing else, other than serving this single web page you are reading now. The fact that you are reading this page means the persistence unit has been initialized.

Requirement for enabling JEST

The requirements for an application to enable JEST are

► JEST Servlet must be deployed within the same module scope of the application.
► The unit name of the persistence unit used by the application must be known to JEST Servlet
► The persistence unit must be configured with
   openjpa.EntityManagerFactoryPool=true

Once JEST servlet knows the name of the persistence unit, it can
► browse the domain model
► execute query
from any web browser in a meta-data driven, generic fashion i.e. without knowing anything further about he application.


WEB-INF/web.xml : Deployment Descriptor for JEST-enabled Application
 <servlet>
   <servlet-name>demo</servlet-name>
   <servlet-class>demo.SimpleApp</servlet-class>
 </servlet>
   <servlet-mapping>
   <servlet-name>demo</servlet-name>
 <url-pattern>/*</url-pattern>
 </servlet-mapping>

 <!-- Deployment descriptor for JESTServlet. -->
 <servlet>
   <servlet-name>jest</servlet-name>
   <servlet-class>org.apache.openjpa.persistence.jest.JESTServlet</servlet-class>
   <init-param>
     <param-name>persistence.unit</param-name>
     <param-value>jestdemo</param-value>
   </init-param>
 </servlet>
 <servlet-mapping>
   <servlet-name>jest</servlet-name>
   <url-pattern>/jest/*</url-pattern>
 </servlet-mapping>