ICYMI: Let’s see how easy it is to implement RESTful services with simple JPA CRUD functionality with Rapidoid, the almighty web framework.
Bootstrapping JPA and Implementing RESTful Services
import org.rapidoid.jpa.JPA; import org.rapidoid.setup.App; import org.rapidoid.setup.On; public class JPADemo { public static void main(String[] args) { App.run(args).jpa(); // bootstrap JPA On.get(“/books”).json(() -> JPA.of(Book.class).all()); On.get(“/books/{id}”).json((Long id) -> JPA.get(Book.class, id)); On.post(“/books”).json((Book b) -> JPA.insert(b)); On.put(“/books/{id}”).json((Book b) -> JPA.update(b)); } }
Of course, we also need some JPA entity (which is over-simplified for this demonstration): https://goo.gl/iadmcG #DataIntegration #ML
Share this:
- Click to share on Facebook (Opens in new window)
- Click to share on Twitter (Opens in new window)
- Click to email a link to a friend (Opens in new window)
- Click to share on LinkedIn (Opens in new window)
- Click to share on Tumblr (Opens in new window)
- Click to share on Pinterest (Opens in new window)
- Click to share on Reddit (Opens in new window)