[hibernate-dev] SynchronizationRegistry: expose read (lookup) operations?

Sanne Grinovero sanne at hibernate.org
Wed Oct 25 09:32:35 EDT 2017


Hi Steve,

do you think it would be sensible for me to explore introducing some
kind of synchronization lookup method on
org.hibernate.resource.transaction.spi.SynchronizationRegistry ?

Today it only exposes a `registerSynchronization` method, which we use
extensively, but then we also have quite some complexity in the Search
code caused by the fact that we can't look the synchronizations up in
a later phase.
Essentially our Synchronization is stateful and we need to update it later.

I'd love to propose a change for ORM6 so allow registering such things
under some kind of id (a string?) so that one can look them back.

current SPI:

    public void registerSynchronization(Synchronization synchronization)

temptative proposal (didn't try it yet..):

   public void registerSynchronization(String id, Synchronization
synchronization);

   public void Synchronization getSynchronization(String id);


does it sound reasonable in principle?

This would imply other users should make up an id unique for their use
case. Alternatively I could live with a Class used as an id, or we
could have the new methods in addition to the existing method for
people not interested in looking things up.

thanks,
Sanne


More information about the hibernate-dev mailing list