Software Development

How to use Hibernate with simple JDBC application

java Sort Enum Properties Monitor Directory File Lambda Expression parameter return types Validate XML String XSD ExecutorService AutoCloseable Try-With-Resources Convert LocalDateTime OffsetDateTime Run Codes Before Shutdown XML Tag Lambda PostgreSQL JDBC invoke JavaScript Applet SFTP Batch hang block main thread MySQL JDBC try-with-resources delete Unencrypted SoapFault Apache CXF Remove XML Element XSLT skip execute finally public static void main constructor fields Eclipse convert Iterator Stream StreamSupport XMLEncoder XMLDecoder rename P6Spy JDBC Example PDF Version JasperReports Run from Ant iReport Page Numbers Count entities persistence context hibernate


This article demonstrates how to use Hibernate 4.3.x with MySQL 5.6.16 in Java using JDBC.

Software Environment

  • Windows 7 Professional SP1
  • Eclipse – Kepler Release
  • Java 1.7 (1.7.0_67 – Windows x86)
  • MySQL 5.6.16 – Community Server (GPL)
  • MySQL Java Connector 5.1.6
  • Hibernate 4.3.7

Database Set Up

The schema contains 3 tables – T_PERSON, T_EDUCATION, and T_CERTIFICATION. They represent a simple profile for a person in a typical job site like LinkedIn or Run these statements in MySQL Server against a database named hibernatesampledb in the order they are listed here.

Person Table

Education Table

Certification Table

Keys and Indexes

Create Maven Project

Creating a Maven project is simple. For instructions, please follow the instructions on How to create the Maven project in Eclipse.


Java Classes

PersonBean Class

EducationBean Class

CertificationBean Class

Main Class

Hibernate Mapping Files




Configure pom.xml


Download the Project

Got comments, or suggestions? Please visit our Facebook page!

You Might Also Like