EB-7: Update JPA/Hibernate Configuration for Hibernate 6.6 Compatibility #24
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Jira Ticket
EB-7: Review and update JPA/Hibernate configuration for Hibernate 6.6 compatibility
Overview
This PR updates the JPA/Hibernate configuration to ensure compatibility with Hibernate 6.6.29. The changes focus on fixing critical configuration issues, enhancing entity annotations, and adding Hibernate 6.6-specific settings for better performance and production safety.
Changes Made
1. Fixed Critical Maven Compiler Plugin Issue
java.versionproperty)2. Updated MySQL Connector Dependency
mysql:mysql-connector-java:8.0.33→com.mysql:mysql-connector-j:8.4.03. Enhanced Application Properties for Hibernate 6.6
Updated
src/main/resources/application.propertieswith:Changed DDL strategy:
spring.jpa.hibernate.ddl-auto=update→validatevalidateprovides better production safety by verifying schema without modifying databaseAdded Hibernate 6.6 compatibility settings:
spring.jpa.properties.hibernate.query.null_ordering=native- Proper null value handling in queriesspring.jpa.properties.hibernate.physical_naming_strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy- Consistent database namingspring.jpa.properties.hibernate.default_batch_fetch_size=10- Improved query performance through batch fetchingspring.jpa.open-in-view=false- Disabled anti-pattern to prevent lazy loading issues4. Enhanced Entity Class Annotations
Account.java:
@Table(name = "account")annotation@Columnannotations with proper constraints:username: nullable=false, unique=true, length=100password: nullable=false, length=255balance: nullable=false, precision=15, scale=2@OneToManyrelationship with explicitFetchType.LAZYTransaction.java:
@Table(name = "transaction")annotation@Columnannotations with proper constraints:amount: nullable=false, precision=15, scale=2type: nullable=false, length=50timestamp: nullable=false@ManyToOnerelationship withFetchType.LAZYand proper foreign key constraint5. Repository Interfaces
AccountRepositoryandTransactionRepositoryare fully compatible with Hibernate 6.6Verification
✅ Compilation: Successfully compiled with
mvn clean compile- no errors or warnings✅ Packaging: Successfully packaged with
mvn package -DskipTests- build completed successfully✅ Java Version: Maven compiler now correctly uses Java 17
✅ Dependencies: All dependencies resolved successfully with updated versions
Benefits
validateprevents accidental schema modificationsNotes
Testing Recommendations
Before merging, consider:
validate)open-in-view=falseLink to Devin run: https://app.devin.ai/sessions/2c49af10ea074d0abf3c3bfc686e1159
Requested by: Alex Peng (alex.peng@windsurf.com) / @alexjpeng