openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pinaki Poddar (JIRA)" <>
Subject [jira] Commented: (OPENJPA-1851) RESTful access to Persistence Unit runtime
Date Mon, 25 Oct 2010 21:58:21 GMT


Pinaki Poddar commented on OPENJPA-1851:

Proposed URI  Syntax for REST on OpenJPA
  * REST as a interaction paradigm
  * HTTP as communication protocol
  * JPA as a service
  A client having no Java, no access to persistent domain class definitions can be enabled
to access
  JPA features e.g. querying a database with an object-oriented view and receive a XML or
HTML document
  over HTTP. 
  This brief note proposes a protocol syntax to carry out such an interaction. 
   action : denotes the JPA operation to be performed.
            must be the first path segment of a HTTP URI
            For example one of {find, query, insert, merge, remove, properties, domain}

   option : qualifies the action. 
            specific to the action.
            For example, a query action can qualify with query/single to get a single result.
            zero or more options can be specified. 
            options are separated by forward slash
            options may have value e.g. query/fecthplan=myPlan/ignoreCache/maxResult=20?select
p from Person ... 
            options are not order dependent  
   param  : parameter for the action
            For example, JPQL string as well the query parameters are params for a query action
            zero or more param can be specified
            params are separated by semicolon
            params may have value     

Few examples

01. Get name of the persistent unit
02. List simple name of the domain classes
03. List the key-value properties of the persistent unit
04. Find an instance by key;123456789
    Comment: simple name of the server-side Java types should suffice, unless ambiguous for
the persistence unit
05. Find an instance by key;ssn=123456789;name=Pinaki
    Comment: This form is required when compound keys are used

06. Get the result of the query with no parameter p from Person p

07. Get the result of the query with single parameter p from Person p where;name=Pinaki

08. Get the result of the query with multiple parameters p from Person p where and age > :age;name=Pinaki;age=20 p from Person p where p.first=:first and p.last=:last;first=Pinaki;last=Poddar
    Comment: Notice that age is a numeric parameter and needs to be implicitly converted before
JPA query is executed.
             Some changes in OpenJPA kernel is needed to handle/relax parameter type checking.
09. Get the single result of the query 
 p from Person p where;name=Pinaki

10. Get the result of the named query     ;name=Pinaki
11. Get the single result of the named query;name=Pinaki;name=Pinaki
   Comment: both forms are equivalent

Host syntax:

A OpenJPA runtime running at with port 6789 listening for HTTP requests on the
above syntax. 

> RESTful access to Persistence Unit runtime 
> -------------------------------------------
>                 Key: OPENJPA-1851
>                 URL:
>             Project: OpenJPA
>          Issue Type: New Feature
>          Components: competitive, jpa, usability
>            Reporter: Pinaki Poddar
>            Assignee: Pinaki Poddar
> A persistence unit should provide access to a remote, non-Java client in a RESTful fashion.
> The communication protocol should be HTTP.
> The 'safe' operations (HTTP GET for find, query, properties, metamodel browsing etc)
can be encoded in URI syntax itself. 
> The state representation would start with schema-less  XML, followed by schema-compliant
> The POST/PUT operations and transactions will be addressed in a separate task.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message