Brahma-HibernateUtils: Entity registration in Dropwizard made dead simple
Dropwizard is a great framework for building backend services, it acts as a connection between popular libraries to jumpstart java applications. But with all these connections comes a lot of boilerplate.
One such ugly boilerplate is the HibernateBundle
, where one must register every @Entity
class for hibernate to recognise it and for SQL queries to work via the DAO classes. Leading to some nasty looking code in the main application class
If the really long boilerplate wasn’t annoying enough, you only get to know about an @Entity
class you forgot to register at runtime with some facepalm exceptions in your logs.
ERROR API_EXCEPTION UnexpectedException: org.hibernate.UnknownEntityTypeException: Unable to locate persister: com.client.model.PorterHouseSteak
If boilerplate and runtime exceptions make you sad, us folks at Gozefo Engineering have got your back!! Presenting Brahma-HibernateUtils an open source library which uses the power of annotation processing in java to keep track of @Entity
classes for you. Making your hibernateBundle
initialisation as simple as:
Brahma_HibernateUtils.java
is a generated class with a list of all classes with an @Entity
annotation, making it super easy to register them.
Brahma-HibernateUtils
is 100% open source and we welcome all kinds of pull requests and help with the docs.
If you love programming and destroying java boilerplate Gozefo Engineering is hiring!!.