Updated Interceptor API in Hibernate 6

Hi,

I noticed that you add some new methods for Interceptor interface.
Now Interceptor’s methods don’t need key that implements Serializable interface.
Am I right in concluding that now primary keys don’t necessarily have to implement Serializable interface.
(Which is very convenient when creating composite keys)
If it’s true, could you update your documentation?
If it’s false, could you explain this moment, please?

Best Regards,
Ilya

We decided to drop the static type requirement, but for certain dynamic operations e.g. caching it might still be necessary to have the primary key class be Serializable. It’s at least good practice that the class is serializable.
You can open a pull request if the documentation section bothers you though and then others can chime in on the discussion about this.

1 Like

Thank you for your explanation!

You mentioned caching. Did you mean first-level cache, second-level cache or both?

As for the documentation, I’ll create a pull-request in order for this point to be clarified after your answer.

P.S. Could you edit title for this issue, please? I think it would be great if title containes Hibernate’s version. (e.g. Updated Interceptor API in Hibernate 6 or [Hibernate 6] Updated Interceptor API)

I mean the second level cache, which might serialize keys.

1 Like