Showing posts from November, 2015

Getting started with Dropwizard: Connecting to a Database using Hibernate

Here is a link to my Getting Started with Dropwizard course on Udemy. Only $10! In the previous installments of this series we discussed how to create a Dropwizard application using Maven archetype and how to use a YAML file to set configuration parameters for the application. In this tutorial we'll create a simple application that exposes an Employee Directory via REST API. For simplicity reasons our representations will not contain hyperlinks, that is we'll talk about Level 2 of Richardson Maturity Model. The sources for the tutorial can be found here.

We'll begin with adding parameters of database connection including credentials, connection URI and database driver name to the application's configuration file. The snippet below shows how to configure the database connection.

MySQL RDBMS was used for our example, but some other DBMS can be used. As we'll use Hibernate to talk to our database, switching databases is a snap, it's only necessary to change t…