<commit_before>package org.lightmare.jpa;

import java.io.IOException;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;

import org.apache.log4j.Logger;
import org.hibernate.jpa.HibernatePersistenceProvider;
import org.lightmare.cache.ConnectionContainer;
import org.lightmare.cache.ConnectionSemaphore;
import org.lightmare.config.Configuration;
import org.lightmare.jndi.JndiManager;
import org.lightmare.jpa.hibernate.HibernatePersistenceProviderImpl;
import org.lightmare.jpa.jta.HibernateConfig;
import org.lightmare.libraries.LibraryLoader;
import org.lightmare.utils.CollectionUtils;
import org.lightmare.utils.NamingUtils;
import org.lightmare.utils.ObjectUtils;
import org.lightmare.utils.StringUtils;

/**
 * Creates and caches {@link EntityManagerFactory} for each EJB bean
 * {@link Class}'s appropriate field (annotated by @PersistenceContext)
 * 
 * @author <NAME>
 * @since 0.0.79-SNAPSHOT
 */
public class JpaManager {

    // Entity classes
    private List<String> classes;

    private String path;

    private URL url;

    // Additional properties
    private Map<Object, Object> properties;

    private boolean swapDataSource;

    private boolean scanArchives;

    // Initialize level class loader
    private ClassLoader loader;

    // Error message for connection binding to JNDI names
    private static final String COULD_NOT_BIND_JNDI_ERROR = "could not bind connection";

    private static final Logger LOG = Logger.getLogger(JpaManager.class);

    private JpaManager() {
    }

    /**
     * Checks if entity persistence.xml {@link URL} is provided
     * 
     * @return boolean
     */
    private boolean checkForURL() {

	return ObjectUtils.notNull(url) && StringUtils.valid(url.toString());
    }

    /**
     * Added transaction properties for JTA data sources
     */
    private void addTransactionManager() {<commit_msg>improved "Hibernate" utilities<commit_after>package org.lightmare.jpa;

import java.io.IOException;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;

import org.apache.log4j.Logger;
import org.hibernate.jpa.HibernatePersistenceProvider;
import org.lightmare.cache.ConnectionContainer;
import org.lightmare.cache.ConnectionSemaphore;
import org.lightmare.config.Configuration;
import org.lightmare.jndi.JndiManager;
import org.lightmare.jpa.hibernate.HibernatePersistenceProviderImpl;
import org.lightmare.jpa.jta.HibernateConfig;
import org.lightmare.libraries.LibraryLoader;
import org.lightmare.utils.CollectionUtils;
import org.lightmare.utils.NamingUtils;
import org.lightmare.utils.ObjectUtils;
import org.lightmare.utils.StringUtils;

/**
 * Creates and caches {@link EntityManagerFactory} for each EJB bean
 * {@link Class}'s appropriate field (annotated by @PersistenceContext)
 * 
 * @author <NAME>
 * @since 0.0.79-SNAPSHOT
 */
public class JpaManager {

    // Entity classes
    private List<String> classes;

    private String path;

    private URL url;

    // Additional properties
    private Map<Object, Object> properties;

    private boolean swapDataSource;

    private boolean scanArchives;

    // Initialize level class loader
    private ClassLoader loader;

    // Error message for connection binding to JNDI names
    private static final String COULD_NOT_BIND_JNDI_ERROR = "could not bind connection";

    private static final Logger LOG = Logger.getLogger(JpaManager.class);

    /**
     * Private constructor to avoid initialization beside
     * {@link JpaManager.Builder} class
     */
    private JpaManager() {
    }

    /**
     * Checks if entity persistence.xml {@link URL} is provided
     * 
     * @return boolean
     */
    private boolean checkForURL() {

	return ObjectUtils.notNull(url) && StringUtils.valid(url.toString());
    }

    /**
     * Added transaction properties for JTA data sources
     */
    private void addTransactionManager() {
{'fraction_non_alphanumeric': 0.09086503513448026, 'fraction_numerical': 0.00242306760358614, 'mean_word_length': 4.0588235294117645, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '667857', 'n_tokens_mistral': 1207, 'n_tokens_neox': 1155, 'n_words': 303}