Package com.jeecms.cms.dao.main.impl

Source Code of com.jeecms.cms.dao.main.impl.CmsUserSiteDaoImpl

package com.jeecms.cms.dao.main.impl;

import org.springframework.stereotype.Repository;

import com.jeecms.cms.dao.main.CmsUserSiteDao;
import com.jeecms.cms.entity.main.CmsUserSite;
import com.jeecms.common.hibernate3.HibernateBaseDao;

@Repository
public class CmsUserSiteDaoImpl extends HibernateBaseDao<CmsUserSite, Integer>
    implements CmsUserSiteDao {
  public CmsUserSite findById(Integer id) {
    CmsUserSite entity = get(id);
    return entity;
  }

  public CmsUserSite save(CmsUserSite bean) {
    getSession().save(bean);
    return bean;
  }

  public int deleteBySiteId(Integer siteId) {
    String hql = "delete from CmsUserSite bean where bean.site.id=:siteId";
    return getSession().createQuery(hql).setParameter("siteId", siteId)
        .executeUpdate();
  }

  public CmsUserSite deleteById(Integer id) {
    CmsUserSite entity = super.get(id);
    if (entity != null) {
      getSession().delete(entity);
    }
    return entity;
  }

  public void delete(CmsUserSite entity) {
    getSession().delete(entity);
  }

  @Override
  protected Class<CmsUserSite> getEntityClass() {
    return CmsUserSite.class;
  }
}
TOP

Related Classes of com.jeecms.cms.dao.main.impl.CmsUserSiteDaoImpl

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.