<commit_before>package org.broadleafcommerce.order.dao;

import javax.annotation.Resource;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.broadleafcommerce.order.domain.FulfillmentGroup;
import org.broadleafcommerce.order.domain.FulfillmentGroupImpl;
import org.broadleafcommerce.order.domain.Order;
import org.broadleafcommerce.profile.util.EntityConfiguration;
import org.broadleafcommerce.type.FulfillmentGroupType;
import org.springframework.stereotype.Repository;

@Repository("fulfillmentGroupDao")
public class FulfillmentGroupDaoJpa implements FulfillmentGroupDao {

    /** Logger for this class and subclasses */
    protected final Log logger = LogFactory.getLog(getClass());

    @PersistenceContext(unitName = "blPU")
    private EntityManager em;

    @Resource
    private EntityConfiguration entityConfiguration;

    @Override
    public FulfillmentGroup maintainFulfillmentGroup(FulfillmentGroup fulfillmentGroup) {
        return em.merge(fulfillmentGroup);
    }

    @SuppressWarnings("unchecked")
    @Override
    public FulfillmentGroup readFulfillmentGroupById(Long fulfillmentGroupId) {
        return (FulfillmentGroup) em.find(entityConfiguration.lookupEntityClass("org.broadleafcommerce.order.domain.FulfillmentGroup"), fulfillmentGroupId);
    }

    @Override
    public FulfillmentGroup maintainDefaultFulfillmentGroup(FulfillmentGroup defaultFulfillmentGroup) {
        if (defaultFulfillmentGroup.getId() == null) {
            em.persist(defaultFulfillmentGroup);
            em.flush();
        } else {
            defaultFulfillmentGroup = em.merge(defaultFulfillmentGroup);
        }
        return defaultFulfillmentGroup;
    }

    @SuppressWarnings("unchecked")
    @Override<commit_msg>always use em.merge() for maintainDefaultFulfillmentGroup<commit_after>package org.broadleafcommerce.order.dao;

import javax.annotation.Resource;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.broadleafcommerce.order.domain.FulfillmentGroup;
import org.broadleafcommerce.order.domain.FulfillmentGroupImpl;
import org.broadleafcommerce.order.domain.Order;
import org.broadleafcommerce.profile.util.EntityConfiguration;
import org.broadleafcommerce.type.FulfillmentGroupType;
import org.springframework.stereotype.Repository;

@Repository("fulfillmentGroupDao")
public class FulfillmentGroupDaoJpa implements FulfillmentGroupDao {

    /** Logger for this class and subclasses */
    protected final Log logger = LogFactory.getLog(getClass());

    @PersistenceContext(unitName = "blPU")
    private EntityManager em;

    @Resource
    private EntityConfiguration entityConfiguration;

    @Override
    public FulfillmentGroup maintainFulfillmentGroup(FulfillmentGroup fulfillmentGroup) {
        return em.merge(fulfillmentGroup);
    }

    @SuppressWarnings("unchecked")
    @Override
    public FulfillmentGroup readFulfillmentGroupById(Long fulfillmentGroupId) {
        return (FulfillmentGroup) em.find(entityConfiguration.lookupEntityClass("org.broadleafcommerce.order.domain.FulfillmentGroup"), fulfillmentGroupId);
    }

    @Override
    public FulfillmentGroup maintainDefaultFulfillmentGroup(FulfillmentGroup defaultFulfillmentGroup) {
        return em.merge(defaultFulfillmentGroup);
        /*if (defaultFulfillmentGroup.getId() == null) {
            em.persist(defaultFulfillmentGroup);
            em.flush();
        } else {
            defaultFulfillmentGroup = em.merge(defaultFulfillmentGroup);
        }
        return defaultFulfillmentGroup;*/
    }

    @SuppressWarnings("unchecked")
    @Override
{'fraction_non_alphanumeric': 0.08247687564234327, 'fraction_numerical': 0.0, 'mean_word_length': 4.8541353383458645, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6039193', 'n_tokens_mistral': 1072, 'n_tokens_neox': 1077, 'n_words': 177}