Sample project using Plain JavaSE – Episode 3

Hi, this is the third post of a series where i’ll be publishing some samples showing how to develop web applications with Java technology.
This post sample consists on a project ‘staffgest-persistence-hibernate-jpa‘ that serves as persistence layer using JPA.
I’ll use Hibernate 5 as a JPA provider and H2 as an in-memory relational database.

On the next episode i’ll plug this project as a dependency on ‘staffgest-mdw‘.

You can read more about JPA in here.
You can read more about Hibernate in here.
You can read more about H2 in here.

For more context please refer to the previous post.

Relevant code snippets:

Persistence.xml
https://gist.github.com/arthurportas/a7fed5a33b69ae1023ea2d250cee1077

Generic DAO interface
https://gist.github.com/arthurportas/020083d56a8b840eabec350c30b7fb83

Generic DAO interface
https://gist.github.com/arthurportas/020083d56a8b840eabec350c30b7fb83

Generic DAO Impl
https://gist.github.com/arthurportas/bcf2cfa0baa221ce351fa1890f4b3f40

Employee DAO Interface
https://gist.github.com/arthurportas/76054e17b43edea4f04fbdff3e82abb7

Employee DAO Impl
https://gist.github.com/arthurportas/525e43b01aecdd780c6a234226da6f26

Employee DAO Tests
https://gist.github.com/arthurportas/fde2b404ba6c7acdcc0cff4c81b0a406

staffgest-persistence-hibernate-jpa‘  – is a maven project, so it should be fairly simple to import and build it.
Hope it’s helpful for someone!

Advertisements