Search in sources :

Example 1 with EntityManagerFactoryProxy

use of org.hotswap.agent.plugin.hibernate3.jpa.proxy.EntityManagerFactoryProxy in project HotswapAgent by HotswapProjects.

the class Hibernate3JPAHelper method createEntityManagerFactoryProxy.

/**
 * Creates the entity manager factory proxy.
 *
 * @param persistenceUnitName            persistent unit name
 * @param properties            properties to create entity manager factory
 * @param original            entity manager factory
 * @return proxy of entity manager
 */
public static EntityManagerFactory createEntityManagerFactoryProxy(String persistenceUnitName, Map<?, ?> properties, EntityManagerFactory original) {
    // ensure only once
    if (wrappedPersistenceUnitNames.contains(persistenceUnitName)) {
        return original;
    }
    wrappedPersistenceUnitNames.add(persistenceUnitName);
    EntityManagerFactoryProxy wrapper = EntityManagerFactoryProxy.getWrapper(persistenceUnitName);
    EntityManagerFactory proxy = wrapper.proxy(original, persistenceUnitName, null, properties);
    initPlugin(original);
    LOGGER.debug("Returning EntityManager proxy {} instead of EntityManager {}", proxy.getClass(), original);
    return proxy;
}
Also used : EntityManagerFactoryProxy(org.hotswap.agent.plugin.hibernate3.jpa.proxy.EntityManagerFactoryProxy) EntityManagerFactory(javax.persistence.EntityManagerFactory)

Example 2 with EntityManagerFactoryProxy

use of org.hotswap.agent.plugin.hibernate3.jpa.proxy.EntityManagerFactoryProxy in project HotswapAgent by HotswapProjects.

the class Hibernate3JPAHelper method createContainerEntityManagerFactoryProxy.

/**
 * Creates the container entity manager factory proxy.
 *
 * @param info            persistent unit definition
 * @param properties            properties to create entity manager factory
 * @param original            entity manager factory
 * @return proxy of entity manager
 */
public static EntityManagerFactory createContainerEntityManagerFactoryProxy(PersistenceUnitInfo info, Map<?, ?> properties, EntityManagerFactory original) {
    // ensure only once
    if (wrappedPersistenceUnitNames.contains(info.getPersistenceUnitName())) {
        return original;
    }
    wrappedPersistenceUnitNames.add(info.getPersistenceUnitName());
    EntityManagerFactoryProxy wrapper = EntityManagerFactoryProxy.getWrapper(info.getPersistenceUnitName());
    EntityManagerFactory proxy = wrapper.proxy(original, info.getPersistenceUnitName(), info, properties);
    initPlugin(original);
    LOGGER.debug("Returning container EntityManager proxy {} instead of EntityManager {}", proxy.getClass(), original);
    return proxy;
}
Also used : EntityManagerFactoryProxy(org.hotswap.agent.plugin.hibernate3.jpa.proxy.EntityManagerFactoryProxy) EntityManagerFactory(javax.persistence.EntityManagerFactory)

Aggregations

EntityManagerFactory (javax.persistence.EntityManagerFactory)2 EntityManagerFactoryProxy (org.hotswap.agent.plugin.hibernate3.jpa.proxy.EntityManagerFactoryProxy)2