项目作者: iavinash

项目描述 :
JPA Entity Relationships(Mappings), ex- @OneToOne, @ManyToOne etc.
高级语言: Java
项目地址: git://github.com/iavinash/hibernate-mappings.git
创建时间: 2021-05-15T20:03:30Z
项目社区:https://github.com/iavinash/hibernate-mappings

开源协议:

下载


📘 Hibernate-Mappings Examples with Spring Data JPA

This project demonstrates core JPA Entity Relationships such as:

🗃️ 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