How to setup Hibernate JPA in Spring-Boot project without Spring Data?

829 views Asked by At

I am quite new to Spring and have a task to create a multi-module project that needs to use Hibernate JPA and Spring-Boot (Spring Data JPA is not allowed for this project).

I am using the PostgreSQL database and org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.2.Final.

I added hibernate JPA and on its own, it works but I don't know how to configure it to work in my spring-boot project. And most examples use spring-data-jpa.

I tried @PersitenceContect annotation for my EntityManager but that doesn't work.

I also tried following this: https://allaroundjava.com/hibernate-jpa-spring-tutorial/ But maybe because of different databases or maybe smth else I couldn't get it to work.

I solved this by following JPA configuration described in this question: Spring Boot + Hibernate JPA configuration to use EntityManager

1

There are 1 answers

1
XII On

A great tutorial with an example (with postgres) is the following one : https://www.bezkoder.com/spring-boot-postgresql-example/

It shows how to structure your file structure (etc) which is nice.