Class JpaAutoFlushListener

  • All Implemented Interfaces:
    Serializable, org.hibernate.event.service.spi.JpaBootstrapSensitive, org.hibernate.event.spi.AutoFlushEventListener

    public class JpaAutoFlushListener
    extends org.hibernate.event.internal.DefaultAutoFlushEventListener
    Extends Hibernate's DefaultAutoFlushEventListener to always flush queued inserts to allow correct handling of orphans of that entities in the same transactions, and also to clear a session-level query cache.

    If they wouldn't be flushed, they won't be orphaned (at least not in Hibernate 5.3.24.Final). This class copies over all functionality of the base class that can't be overwritten via inheritance. This is being tracked as part of keycloak/keycloak#11666.

    This also clears the JPA map store query level cache for the JpaMapKeycloakTransaction whenever there is some data written to the database.

    See Also:
    Serialized Form
    • Constructor Detail

      • JpaAutoFlushListener

        public JpaAutoFlushListener()
    • Method Detail

      • onAutoFlush

        public void onAutoFlush​(org.hibernate.event.spi.AutoFlushEvent event)
                         throws org.hibernate.HibernateException
        Specified by:
        onAutoFlush in interface org.hibernate.event.spi.AutoFlushEventListener
        onAutoFlush in class org.hibernate.event.internal.DefaultAutoFlushEventListener