Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-dev] Feedback Requested - JPA RESTful Service (ER-326663)

Hi Tom,

Thanks for the feed back.  I'll address your questions below inlined in blue.

Tom Ware wrote:
Hi Blaise,

  Some comments/questions:

--------
- I am kind of surprised how different the URLs for simple PKs and composite PKs are.

i.e. if a composite PK looks like this:

"http://www.example.com/customer-app/rest/customers;id=1;country=CA"

Why isn't a simple PK more like this:

"http://www.example.com/customer-app/rest/customers;id=1"
The ideal URL for a RESTful resource is like the one below with the ID as part of the path:

http://www.example.com/customer-app/rest/customers/1

This type of pattern can be seen all over the web:
It is for the composite key case that we need to deviate from the standard representation:

-----------

- For queries, how do you distinguish if the URL refers to a query or a find?

i.e. How do you know http://www.example.com/customer-app/rest/customers/findCustomerByName isn't referring to an entity called "findCustomerByName"?

Is it the fact that I have some reserved words, "singleResult" and "resultList" that come later in the URL?

The RESTful JPA service will be limited to one root entity.  This entity will be the input and output of all operations.  The supported named queries will be limited to named queries that return one or many instances of that entity (or subtypes).

For the following URL:

http://www.example.com/customer-app/rest/customers/findCustomerByName/resultList
  • "findCustomersByName" is the name of the named query, passing in another path fragment will cause another named query to be created
  • resultList & singleResult are reserved path names to indicate the result type


-----------

How is the initial metadata obtained?  How is the session built?
The user implemented subclass is responsible for implementing a method called entityManager() to return the entityManager.  I expect that users will implement their RESTful service as a session bean and will gain access to the EntityMangager through the use of @PersistenceContext.

-----------

How do you figure out the parameter types for named queries?

Are there core features that need implementation for this to work?

-----------

-Tom

The parameter types for named queries can be obtained from the name query itself.  No features are required, only a fix to the following bug:


Blaise Doughan wrote:
Hello All,

I am developing a new EclipseLink feature that will expose a JPA EnitityManager as a RESTful (JAX-RS) service.  The relevant collateral can be found below.  I will send out design review details soon.

*Enhancement Request:*

    * http://bugs.eclipse.org/326663

*Design Document:*

    * http://wiki.eclipse.org/EclipseLink/DesignDocs/326663

-Blaise


------------------------------------------------------------------------

_______________________________________________
eclipselink-dev mailing list
eclipselink-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-dev
_______________________________________________
eclipselink-dev mailing list
eclipselink-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-dev

-Blaise

Back to the top