I was reading a blog article the other day and decided to try the code out myself, however, I wanted to do it my way so I changed several things along the way. This article will outline what I did to get NetBeans 7 working with Spring, Hibernate, HSQLDB, JUnit and Maven all working together. The original code for the original article can be found here.

I began my project by creating a new Maven project called: SimpleSpringHibernate.

I added the following dependencies:

Note: Keep in mind you only really need to add Hibernate, Spring Framework, JUnit, HSQLDB, and the rest will be pulled in by Maven. I’ve included the above screen shot though just to to show everything as I had it configured.

I created just one entity called Employee which takes an id, name and a department. It is wired up for Hibernate and fairly simple to understand.