com.hyron.poscafe.dao.CashDrawerOptDaoImpl.java Source code

Java tutorial

Introduction

Here is the source code for com.hyron.poscafe.dao.CashDrawerOptDaoImpl.java

Source

/*
 * Copyright (C) 2018
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.hyron.poscafe.dao;

// Generated 2013-4-29 15:51:57 by Hibernate Tools 3.4.0.CR1

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.HibernateException;
import org.hibernate.Session;

import com.hyron.poscafe.model.CashDrawerOpt;

/**
 * DaoImpl object for domain model class CashDrawerOpt.
 *
 * @see com.sotux.poscafe.modelnew.CashDrawerOpt
 * @author Hibernate Tools
 */

public class CashDrawerOptDaoImpl implements CashDrawerOptDao {

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

    @Override
    public void save(CashDrawerOpt entity, Session session) throws HibernateException {
        log.debug("saving CashDrawerOpt instance");
        try {
            session.save(entity);
            log.debug("saving successful");
        } catch (RuntimeException re) {
            log.error("saving failed", re);
            throw re;
        }
    }

    @Override
    public void update(CashDrawerOpt entity, Session session) throws HibernateException {
        log.debug("updating CashDrawerOpt instance");
        try {
            session.update(entity);
            log.debug("update successful");
        } catch (RuntimeException re) {
            log.error("update failed", re);
            throw re;
        }
    }

    @Override
    public void saveOrUpdate(CashDrawerOpt entity, Session session) throws HibernateException {
        log.debug("saving or updating CashDrawerOpt instance");
        try {
            session.saveOrUpdate(entity);
            log.debug("save or update successful");
        } catch (RuntimeException re) {
            log.error("save or update failed", re);
            throw re;
        }
    }

    @Override
    public void delete(CashDrawerOpt entity, Session session) throws HibernateException {
        log.debug("deleting CashDrawerOpt instance");
        try {
            session.delete(entity);
            log.debug("delete successful");
        } catch (RuntimeException re) {
            log.error("delete failed", re);
            throw re;
        }
    }

    @Override
    public CashDrawerOpt merge(CashDrawerOpt detachedInstance, Session session) throws HibernateException {
        log.debug("merging CashDrawerOpt instance");
        try {
            CashDrawerOpt result = (CashDrawerOpt) session.merge(detachedInstance);
            log.debug("merge successful");
            return result;
        } catch (RuntimeException re) {
            log.error("merge failed", re);
            throw re;
        }
    }

    @Override
    public CashDrawerOpt findById(long id, Session session) throws HibernateException {
        log.debug("getting CashDrawerOpt instance with id: " + id);
        try {
            CashDrawerOpt instance = (CashDrawerOpt) session.get(CashDrawerOpt.class, id);
            log.debug("get successful");
            return instance;
        } catch (RuntimeException re) {
            log.error("get failed", re);
            throw re;
        }
    }
}