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:


Why isn't a simple PK more like this:

The ideal URL for a RESTful resource is like the one below with the ID as part of the path:

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 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:
  • "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?



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:*


*Design Document:*




eclipselink-dev mailing list
eclipselink-dev mailing list


Back to the top