Deprecation of Tuplizer Class in Hibernate ORM Version 6

Hello Team,
As per the suggestions and recommendations from the fellow community members, i am in the process of upgrading the Hibernate from version 5.2 to version 6.1 which has been released last week.

I had some code which is referring to EntityMode/[Entity/Component]Tuplizers , i am trying to rewrite it with the new implementation, but it looks like the interface has changed.
I looked for some help on the documents and came across this post which was written for version 5.6.

However when i look at the source code in version 6 hibernate-orm/ at main · hibernate/hibernate-orm · GitHub and version 5.6 hibernate-orm/ at 5.6 · hibernate/hibernate-orm · GitHub it looks like the interface functions have changed, some of them are missing.

Can some-one shed some light on how to modify the code with the new implementation?

Thank You in Advance!!

Depends what you are trying to achieve. Please share the purpose of your custom implementation. We have new SPIs to do certain things.

@beikov : We use a tuplizer for persisting an object.
A tuplizer is responsible for:

  • creating the instance of entity which is defined by Instantiator interface.
  • extracting values of a property from the entity which is defined by Getter interface
  • Injecting values for a property into the entity which is defined by Setter interface

Can you please let me know the corresponding SPIs for these functionality?


Controlling extraction and injection for a property can be done by annotating a property with @AttributeAccessor(strategy = MyPropertyAccessStrategy.class). If you don’t want to annotate your model, you can create a org.hibernate.boot.spi.MetadataContributor and apply these configurations on the properties of the respective PersistenceClass instances.

Changing the way entities are instantiated is not possible anymore.

Why do you need to do this? You really shouldn’t need this functionality.

@beikov : In the earlier version of Hibernate 5.2, we were creating mapping (hbmxml) files and then using it to persist the entity. Earlier we were creating a dynamic map for the entity class using the dom4j mapping. I think now for hbmxml, Hibernate is using JAXB, but was wondering how will these persistence operations etc will change.

If you don’t provide a Java class for the entity mappings, the default is to represent entities as dynamic maps i.e. java.util.Map. If that is all you want/need, then you should only have to drop the tuplizer code and be done.