<commit_before>package gov.hhs.fha.nhinc.directconfig.dao.helpers;

import gov.hhs.fha.nhinc.directconfig.persistence.HibernateUtil;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;

public class DaoUtils {

    private static final Log log = LogFactory.getLog(DaoUtils.class);

    public static String toIdString(List<Long> list) {
        StringBuffer idListBuffer = null;
        String idList = null;

        if (list != null) {
            for (Long id : list) {
                if (idListBuffer == null) {
                    idListBuffer = new StringBuffer("(");
                } else {
                    idListBuffer.append(", ");
                }

                idListBuffer.append(id);
            }

            if (idListBuffer != null) {
                idListBuffer.append(")");

                idList = idListBuffer.toString();
            }
        }

        log.debug("ID List: " + idList);

        return idList;
    }

    /**
     * Opens and returns a Session, using the Hibernate SessionFactory.
     * 
     * @return the opened Session.
     */
    public static Session getSession() {
        Session session = null;
        SessionFactory fact = HibernateUtil.getSessionFactory();

        if (fact != null) {
            session = fact.openSession();
        } else {
            log.error("No Session available - SessionFactory is null.");<commit_msg>DirectHBM: Removed function for manually building a string to represent lists (as a Named Parameter) in favor of setParameterList<commit_after>package gov.hhs.fha.nhinc.directconfig.dao.helpers;

import gov.hhs.fha.nhinc.directconfig.persistence.HibernateUtil;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;

public class DaoUtils {

    private static final Log log = LogFactory.getLog(DaoUtils.class);

    /**
     * Opens and returns a Session, using the Hibernate SessionFactory.
     * 
     * @return the opened Session.
     */
    public static Session getSession() {
        Session session = null;
        SessionFactory fact = HibernateUtil.getSessionFactory();

        if (fact != null) {
            session = fact.openSession();
        } else {
            log.error("No Session available - SessionFactory is null.");
{'fraction_non_alphanumeric': 0.09897070467141726, 'fraction_numerical': 0.0, 'mean_word_length': 2.3828647925033466, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '1701274', 'n_tokens_mistral': 710, 'n_tokens_neox': 678, 'n_words': 173}