Simplify persistence configuration using Spring Boot JPA auto-configuration#127
Simplify persistence configuration using Spring Boot JPA auto-configuration#127hyunjilee1132 wants to merge 1 commit intojaygajera17:master2from
Conversation
…ration for easier startup
|
Hi @hyunjilee1132, Thank you for your contribution. I was planning to do this enhancement but thank you for doing it and making the process a bit easier. The PR looks good to me. I think it would be best if you can raise an issue and attach that issue to this PR. What do you think? |
|
Hi @abdurraffaysyed, thank you for the feedback! I've created the issue #128 and linked it to this PR as requested. |
|
Thank you for the approval, @abdurraffaysyed and @Mohrip! I checked the action logs and noticed that the 'label' check failed because .github/labeler.yml is missing in the repository. Since this seems to be a repository configuration issue rather than an error in my code, could you please check if it's possible to proceed with the merge? Thank you! |
Closes #128
Summary
This PR simplifies the persistence configuration by relying on Spring Boot’s JPA auto-configuration.
The following changes were made:
HibernateConfiguration.javaexcludesettings from@SpringBootApplicationapplication.propertiesEntityManagerFactoryand transaction configuration automaticallyThese changes reduce configuration conflicts between manual Hibernate setup and Spring Data JPA, and make the project easier to start and understand.
Motivation
The main reason for this change is developer experience, especially for beginners.
When cloning the project for learning purposes, the application could not be started easily due to multiple configuration errors related to persistence setup.
From a beginner’s point of view, this makes the learning process unnecessarily difficult.
Today, most Spring Boot projects rely on JPA with Hibernate as the underlying engine, managed through auto-configuration.
Compared to manually configuring Hibernate
SessionFactoryand transactions, working with Spring Data JPA is generally more approachable and widely used in modern Spring projects.For this reason, I refactored the configuration to use a more beginner-friendly and commonly adopted setup, so that new learners can clone the repository and run the project with minimal friction.
Notes
After this change, the application runs successfully, but some Hibernate warning logs may still appear in the console (they are warnings, not errors).
I considered switching
spring.jpa.hibernate.ddl-autotovalidateto fully align entity mappings with the existing database schema.However, doing so would require updating all entities in the
modelspackage to explicitly match table and column names.To keep this PR focused on fixing startup and configuration issues, I did not include those entity changes here.
If you would like me to:
ddl-auto=validate, andplease leave a comment and I’ll be happy to follow up with another PR.