Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

JEST is a REST style access to any OpenJPA runtime.
REST (Representational State Transfer) is a foundational concept in the architecture for World Wide Web. JEST promotes REST style interaction between a client and an application based on OpenJPA. A JEST-enabled OpenJPA runtime embeds a specialized HTTP server such that a JEST can be deployed in as a servlet for a web application using OpenJPA as a persistence provider. A client (neither necessarily in Java nor having any definition of the persistent server objects) can send HTTP requests and receive persistent data as response in JSON, XML or other string based format.

Effectively there are three aspects to JEST

JEST is described under the following sections

Protocol

The communication protocol for JEST is HTTP. The client sends request in standard HTTP URI (Uniform Resource Identifier) e.g. http://www.jpa.com:6789/find?Person&JohnImage Removed to a JEST-enabled OpenJPA application to find a Person with primary key 'John'. The server will send a HTTP response back to the client. The content of the HTTP response can be formatted as XML or as JSON. The URI syntax governs the server response. Before describing the syntax in detail, here are few typical example URI and their associated effect on the server.

 

Server Function

JEST URI

01

Get name of the persistent unit

http://www.jpa.com:6789/

02

List simple name of the domain classes

http://www.jpa.com:6789/domain

03

List the key-value properties of the persistent unit

http://www.jpa.com:6789/properties

04

Find an instance by key

http://www.jpa.com:6789/find?Person&123456789

05

Find an instance by key

http://www.jpa.com:6789/find?Person&ssn=123456789&name=John

06

Get the result of the query with no parameter

http://www.jpa.com:6789/query?select p from Person p

07

Get the result of the query with single parameter

http://www.jpa.com:6789/query?select p from Person p where p.name=:name&name=John

08.1

Get the result of the query with multiple parameters

http://www.jpa.com:6789/query?select p from Person p where p.name=:name and age > :age&name=John&age=20

08.2

 

http://www.jpa.com:6789/query?select p from Person p where p.first=:first and p.last=:last&first=John&last=Doe

09

Get the single result of the query

http://www.jpa.com:6789/query/single?select p from Person p where p.name=:name&name=John

10

Get the result of the named query

http://www.jpa.com:6789/query/named?QueryPersonByName&name=John

11.1

Get the single result of the named query

http://www.jpa.com:6789/query/single/named?QueryPersonByName&name=John

11.2

or

http://www.jpa.com:6789/query/named/single?QueryPersonByName&name=John

12

Get first 20 rows of query using a fetch plan

http://www.jpa.com:6789/query/fecthplan=myPlan/ignoreCache/maxResult=20?selectImage Removed

p from Person p

...

titleURI syntax for JEST

...

...