Skip to content

Simplify persistence configuration using Spring Boot JPA auto-configuration#127

Open
hyunjilee1132 wants to merge 1 commit intojaygajera17:master2from
hyunjilee1132:hyunjilee1132
Open

Simplify persistence configuration using Spring Boot JPA auto-configuration#127
hyunjilee1132 wants to merge 1 commit intojaygajera17:master2from
hyunjilee1132:hyunjilee1132

Conversation

@hyunjilee1132
Copy link
Copy Markdown

@hyunjilee1132 hyunjilee1132 commented Dec 30, 2025

Closes #128

Summary

This PR simplifies the persistence configuration by relying on Spring Boot’s JPA auto-configuration.

The following changes were made:

  • Removed the legacy HibernateConfiguration.java
  • Removed exclude settings from @SpringBootApplication
  • Unified database and JPA settings in application.properties
  • Let Spring Boot manage EntityManagerFactory and transaction configuration automatically

These 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 SessionFactory and 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-auto to validate to fully align entity mappings with the existing database schema.
However, doing so would require updating all entities in the models package 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:

  • switch to ddl-auto=validate, and
  • update all entity mappings accordingly,

please leave a comment and I’ll be happy to follow up with another PR.

@abdurraffaysyed
Copy link
Copy Markdown

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?

Copy link
Copy Markdown

@Mohrip Mohrip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGT

@hyunjilee1132
Copy link
Copy Markdown
Author

Hi @abdurraffaysyed, thank you for the feedback! I've created the issue #128 and linked it to this PR as requested.
And thanks @Mohrip for the approval and the comment!

@hyunjilee1132
Copy link
Copy Markdown
Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simplify persistence configuration using Spring Boot JPA auto-configuration

3 participants