Monthly Archives: April 2014

First hibernate application

Tools used:

  1. Postgresql Database(9.3) – http://www.postgresql.org/download/
  2. Hibernate Jars (4.3.4)- http://hibernate.org/orm/downloads/
  3. Postgres JDBC Driver – http://jdbc.postgresql.org/

Steps to create:

  1. Create a testProject in your eclipse and include the hibernate Jars and Postgres JDBC driver in your class path.
  2. Create a hibernate.cfg.xml file and it should look like this.
  3. Create a DTO POJO with getters and setters method. Add @Entity Annotation to the top of that class.
  4. Create a test class with main() function. The main() function will look something like:
  5. Run the application as a Java application and see the results in postgresDB.

Changes can be updated from this location: https://github.com/volcanicprateek/hibernateTest.git

References: