Access Database with Java using JPA - Hibernate

Last updated: 2025-09-14

Steps:

  1. Create Maven project with the following pom.xml:

Unresolved include directive in modules/6.x.x/pages/frameworks/jk-framework/jk-framework-data/java-simple-jpa-hibernate-tutorial.adoc - include::inc/jpa/pom.xml[]

If you are using Eclipse, be sure to refresh your project (select your project→ right click→ Maven→ Update Project)

  1. Create config file at src/main/resources/config.properties with the following contents:

Unresolved include directive in modules/6.x.x/pages/frameworks/jk-framework/jk-framework-data/java-simple-jpa-hibernate-tutorial.adoc - include::inc/jpa/src/main/resources/config.properties[]
  1. Create Model with the following contents:

Unresolved include directive in modules/6.x.x/pages/frameworks/jk-framework/jk-framework-data/java-simple-jpa-hibernate-tutorial.adoc - include::inc/jpa/src/main/java/com/app/Model.java[]
  1. Create Main class with the following contents:

Unresolved include directive in modules/6.x.x/pages/frameworks/jk-framework/jk-framework-data/java-simple-jpa-hibernate-tutorial.adoc - include::inc/jpa/src/main/java/com/app/App.java[]

Thats it, now run your App class.

Output

Full example source-code can be found at https://github.com/smartapi-com/j-framework-data-jpa