REST Enable Your Database for CRUD with TopLink/EclipseLink and JDeveloper
Join the DZone community and get the full member experience.Join For Free
It seems that REST interfaces are all the rage now for accessing your backend data, this is especially true in the world of mobile development. In this blog I'm going to show you how easy it is to provide a complete REST interface for your database by leveraging TopLink/EclipseLink and JDeveloper.
This relies on a capability that is available in TopLink 12c where every JPA entity that you have created can be RESTified with a simple servlet that TopLink provides.
All you need to do is locate the file toplink-dataservices-web.jar on your machine (this is included in the JDeveloper install so you can just search that directory) and then package your project as a WAR.
At that point you'll be able to get a complete CRUD set of operation for this entity.
In the video below I'm to retrieving departments by their id using a URL like this:
(out - name of my persistence unit. Departments - name of my entity)
A complete list of all the REST URL syntax is here part of the TopLink documentation on this feature.:
Check out how easy the process is in this video (using MySQL database):
Published at DZone with permission of Shay Shmeltzer, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.