Skip to content

Hibernate 6 movement with dropwizard 2#144

Open
AshayKing wants to merge 8 commits intosantanusinha:hibernate6from
AshayKing:hibernate-6-upgrade
Open

Hibernate 6 movement with dropwizard 2#144
AshayKing wants to merge 8 commits intosantanusinha:hibernate6from
AshayKing:hibernate-6-upgrade

Conversation

@AshayKing
Copy link
Contributor

No description provided.

@AshayKing AshayKing changed the base branch from master to hibernate6 January 19, 2026 08:18
import java.math.BigDecimal;

@Converter
public class BigDecimalAttributeConverter implements AttributeConverter<BigDecimal, BigDecimal> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@AshayKing Is this needed ? Check if any converter is needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@typedefs @TypaDef annotation support removed..hence added this cases (mainly used for Encryption use case)

src/test/java/io/appform/dropwizard/sharding/dao/testdata/entities/TestEncryptedEntity.java - added needed code changes details here


@Data
@Builder
public class GetByLookupKey<T, R> extends OpContext<R> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What was the reason to make this change @ashay ?

pom.xml Outdated
<groupId>io.appform.dropwizard.sharding</groupId>
<artifactId>db-sharding-bundle</artifactId>
<version>2.1.12-1</version>
<version>2.1.12-1-HIBERNATE6</version>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@r0goyal please suggest on naming convention of release version..will update accordingly

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's use this 2.1.12-HIBERNATE6-RC0

@@ -43,18 +42,6 @@ protected Session currentSession() {
return sessionFactory.getCurrentSession();
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

This class was copied from dropwizard hibernate package into this repo. Let's check dropwizard-hibernate module for 5.x and see if anything else should be added/removed from here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No major changes apart from import changes + movement from Serilizable to Object for id lookup

return query.executeUpdate();
}

public QuerySpec<T, T> getQuerySpec(final Object key) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this method require public visibility ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed...not needed

configuration.setProperty(AvailableSettings.USE_SQL_COMMENTS, Boolean.toString(dbConfig.isAutoCommentsEnabled()));
configuration.setProperty(AvailableSettings.USE_GET_GENERATED_KEYS, "true");
configuration.setProperty(AvailableSettings.GENERATE_STATISTICS, "true");
configuration.setProperty(AvailableSettings.USE_REFLECTION_OPTIMIZER, "true");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this removed ? Is this now set by default ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Byte Buddy Default: Hibernate 6 has fully transitioned to Byte Buddy as its primary bytecode provider. This engine is highly optimized out of the box, making the manual "reflection optimizer" toggle obsolete.

They have made default as part of optimisation

configuration.setProperty(AvailableSettings.USE_REFLECTION_OPTIMIZER, "true");
configuration.setProperty(AvailableSettings.ORDER_UPDATES, "true");
configuration.setProperty(AvailableSettings.ORDER_INSERTS, "true");
configuration.setProperty(AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, "true");
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the implication of removing these properties ?

* @see Session#saveOrUpdate(Object)
*/
protected E persist(E entity) throws HibernateException {
currentSession().saveOrUpdate(requireNonNull(entity));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is deprecated in h6...either merge/persist needed to be used (multiple cases failing due to this)

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.

2 participants