Package com.carmanconsulting.hibiscus.event.spring

Source Code of com.carmanconsulting.hibiscus.event.spring.EntityManagerEventListenerBootstrap

package com.carmanconsulting.hibiscus.event.spring;

import org.hibernate.ejb.HibernateEntityManagerFactory;
import org.hibernate.event.service.spi.EventListenerRegistry;
import org.hibernate.internal.SessionFactoryImpl;

public class EntityManagerEventListenerBootstrap extends AbstractEventListenerBootstrap
{
//----------------------------------------------------------------------------------------------------------------------
// Fields
//----------------------------------------------------------------------------------------------------------------------

    private final HibernateEntityManagerFactory entityManagerFactory;

//----------------------------------------------------------------------------------------------------------------------
// Constructors
//----------------------------------------------------------------------------------------------------------------------

    public EntityManagerEventListenerBootstrap(HibernateEntityManagerFactory entityManagerFactory)
    {
        this.entityManagerFactory = entityManagerFactory;
    }

//----------------------------------------------------------------------------------------------------------------------
// Other Methods
//----------------------------------------------------------------------------------------------------------------------

    @Override
    protected EventListenerRegistry getEventListenerRegistry()
    {
        SessionFactoryImpl sessionFactoryImpl = (SessionFactoryImpl) entityManagerFactory.getSessionFactory();
        return sessionFactoryImpl.getServiceRegistry().getService(EventListenerRegistry.class);
    }
}
TOP

Related Classes of com.carmanconsulting.hibiscus.event.spring.EntityManagerEventListenerBootstrap

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.