Skip to content

iavinash/hibernate-mappings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📘 Hibernate-Mappings Examples with Spring Data JPA

This project demonstrates core JPA Entity Relationships such as:

  • @OneToOne
  • @ManyToOne
  • @OneToMany
  • @ManyToMany

🗃️ Database Setup

No external relational database setup is required.

  • Uses H2 in-memory database (lightweight ~2MB footprint)
  • Fully supports both JDBC and R2DBC access
  • Ideal for rapid prototyping, unit testing, and learning purposes

H2 Console

📌 Setup

You can insert sample data into various JPA entity relationships using the following API endpoints. Sample JSON payloads are available here.


🔗 API Endpoints

  • POST /api/emp/create Inserts data into a @OneToOne relationship.

  • POST /api/tchr/create Insert data into @OneToMany relationship.

    👉 Data is automatically populated at startup using a CommandLineRunner.

  • POST /api/movie/create Inserts data into a @ManyToMany relationship.


🚀 Application Info

  • The application starts on port 8082 by default.
  • You can change the port configuration in application.properties.

Libraries used

  • Spring Boot
  • Spring Data JPA with Hibernate
  • H2

Tools used

  • Git 2.24.0
  • IntelliJ IDEA 2021.1.1.1
  • Gradle

Releases

No releases published

Packages

No packages published

Languages