{"id":17350324,"url":"https://github.com/codecshekhar/spring-boot-hibernate-jpa-example","last_synced_at":"2026-05-19T03:34:40.719Z","repository":{"id":257826365,"uuid":"859825459","full_name":"CodeCshekhar/spring-boot-hibernate-jpa-example","owner":"CodeCshekhar","description":"This repository contains spring-boot-hibernate-jpa concepts to illustrate its advantages ","archived":false,"fork":false,"pushed_at":"2024-09-20T15:12:40.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T12:19:02.035Z","etag":null,"topics":["h2-database","hibernate-jpa","lombok","spring-boot"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CodeCshekhar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-19T10:47:53.000Z","updated_at":"2024-12-04T07:09:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"a5342237-766a-4f53-a4c4-d6c48ed426d4","html_url":"https://github.com/CodeCshekhar/spring-boot-hibernate-jpa-example","commit_stats":null,"previous_names":["codecshekhar/spring-boot-hibernate-jpa-example"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CodeCshekhar/spring-boot-hibernate-jpa-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeCshekhar%2Fspring-boot-hibernate-jpa-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeCshekhar%2Fspring-boot-hibernate-jpa-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeCshekhar%2Fspring-boot-hibernate-jpa-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeCshekhar%2Fspring-boot-hibernate-jpa-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodeCshekhar","download_url":"https://codeload.github.com/CodeCshekhar/spring-boot-hibernate-jpa-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeCshekhar%2Fspring-boot-hibernate-jpa-example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264251094,"owners_count":23579624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["h2-database","hibernate-jpa","lombok","spring-boot"],"created_at":"2024-10-15T17:06:31.160Z","updated_at":"2026-05-19T03:34:40.678Z","avatar_url":"https://github.com/CodeCshekhar.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spring Boot Hibernate JPA Example\n\nThis Example demonstrates the use of Spring Boot with Hibernate JPA, Lombok, and H2 database. It also includes information about using MySQL as an alternative database.\n\n## Table of Contents\n- [Technologies Used](#technologies-used)\n- [Project Setup](#project-setup)\n- [Configuration](#configuration)\n- [Running the Application](#running-the-application)\n- [H2 Database](#h2-database)\n- [Using MySQL](#using-mysql)\n- [Lombok](#lombok)\n\n## Technologies Used\n- Spring Boot\n- Hibernate JPA\n- Lombok\n- H2 Database\n- MySQL (optional)\n\n## Project Setup\n1. Ensure you have Java JDK 11 or later installed.\n2. Clone this repository: `git clone https://github.com/Chandrashekharwagh/spring-boot-hibernate-jpa-example.git`\n3. Navigate to the project directory: `cd spring-boot-hibernate-jpa-example`\n4. Build the project: `./mvnw clean install` (or `mvnw clean install` on Windows)\n\n## Project Structure\n\n```\nsrc\n├── main\n   ├── java\n   │   └── com\n   │       └── example   \n   │               ├── SpringbootJpaApplication.java\n   │               ├── controller\n   │               ├── model\n   │               ├── repository\n   │               └── service\n   └── resources\n       └── application.properties\n```\n\n## Configuration\nThe project uses `application.properties` for configuration. Here's a sample configuration:\n\n```properties\n# H2 Database Configuration\nspring.datasource.url=jdbc:h2:mem:testdb\nspring.datasource.driverClassName=org.h2.Driver\nspring.datasource.username=sa\nspring.datasource.password=password\nspring.jpa.database-platform=org.hibernate.dialect.H2Dialect\n\n# Hibernate Configuration\nspring.jpa.hibernate.ddl-auto=update\nspring.jpa.show-sql=true\n\n# H2 Console Configuration\nspring.h2.console.enabled=true\nspring.h2.console.path=/h2-console\n```\n\n## Running the Application\nTo run the application, use the following command:\n\n```\n./mvnw spring-boot:run\n```\n\nThe application will start on `http://localhost:8080`.\n\n## H2 Database\nThis project uses H2 as the default in-memory database. You can access the H2 console at `http://localhost:8080/h2-console`. Use the following details to log in:\n- JDBC URL: `jdbc:h2:mem:testdb`\n- Username: `sa`\n- Password: `password`\n\n## Using MySQL\nTo use MySQL instead of H2, follow these steps:\n\n1. Add the MySQL dependency to your `pom.xml`:\n   ```xml\n   \u003cdependency\u003e\n       \u003cgroupId\u003emysql\u003c/groupId\u003e\n       \u003cartifactId\u003emysql-connector-java\u003c/artifactId\u003e\n       \u003cscope\u003eruntime\u003c/scope\u003e\n   \u003c/dependency\u003e\n   ```\n\n2. Update `application.properties`:\n   ```properties\n   spring.datasource.url=jdbc:mysql://localhost:3306/your_database_name\n   spring.datasource.username=your_username\n   spring.datasource.password=your_password\n   spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver\n   spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect\n   ```\n\n3. Create the MySQL database:\n   ```sql\n   CREATE DATABASE your_database_name;\n   ```\n\n4. Restart your application.\n\n## Lombok\nThis project uses Lombok to reduce boilerplate code. Ensure your IDE has Lombok plugin installed for proper support.\n\nTo use Lombok in your entities:\n\n```java\nimport lombok.Data;\nimport lombok.NoArgsConstructor;\nimport lombok.AllArgsConstructor;\n\n@Data\n@NoArgsConstructor\n@AllArgsConstructor\n@Entity\npublic class YourEntity {\n    @Id\n    @GeneratedValue(strategy = GenerationType.IDENTITY)\n    private Long id;\n    \n    private String name;\n    // Other fields...\n}\n```\n\nThis setup allows you to use Lombok annotations like `@Data`, `@NoArgsConstructor`, and `@AllArgsConstructor` to automatically generate getters, setters, constructors, and other common methods.\n\nFor more information on Lombok, visit [Project Lombok](https://projectlombok.org/).\n\n## Usage\n\n1. Define your entities in the `model` package using JPA annotations and Lombok annotations.\n2. Create repositories in the `repository` package by extending `JpaRepository`.\n3. Implement your business logic in the `service` package.\n4. Create REST endpoints in the `controller` package.\n\n## License\n\nThis project is licensed under the MIT License - see the `LICENSE.md` file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodecshekhar%2Fspring-boot-hibernate-jpa-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodecshekhar%2Fspring-boot-hibernate-jpa-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodecshekhar%2Fspring-boot-hibernate-jpa-example/lists"}