1

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

Judita
  • 119
  • 1
  • 2
  • 8
  • Just add hibernate, entities and provide datasource configuration. – M. Deinum Mar 24 '22 at 14:07
  • What is being done in that question isn't needed you can ditch all that. What I stated in the comment is all you need, nothing more nothing less. – M. Deinum Mar 24 '22 at 14:16

1 Answers1

-1

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.

Dharman
  • 30,962
  • 25
  • 85
  • 135
XII
  • 420
  • 4
  • 16