⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 roleauthdaohibernate.java

📁 《JSP网站开发典型模块与实例精讲》一书光盘源码
💻 JAVA
字号:
/*
 * Created on 2006-2-3
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package org.appfuse.dao.hibernate;

import java.util.List;

import org.springframework.orm.ObjectRetrievalFailureException;

import org.appfuse.dao.RoleAuthDAO;
import org.appfuse.model.RoleAuth;

/**
 * @author user
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class RoleAuthDAOHibernate
    extends BaseDAOHibernate
    implements RoleAuthDAO {

    public void saveRoleAuth(final RoleAuth roleAuth) {
        getHibernateTemplate().saveOrUpdate(roleAuth);
        getHibernateTemplate().flush();
    }

    private List getRoleAuth(RoleAuth roleAuth) {
        return getHibernateTemplate()
            .find("from RoleAuth a where a.roleid = " + roleAuth.getRoleid() +
                  " and a.authid = " + roleAuth.getAuthid());
    }

    public void removeRoleAuth(RoleAuth roleAuth) {
        List list = getHibernateTemplate()
            .find("from RoleAuth a where a.roleid = " + roleAuth.getRoleid() +
                  " and a.authid = " + roleAuth.getAuthid());
        for(int i = 0; i < list.size(); i++){
            roleAuth = (RoleAuth)list.get(i);
            getHibernateTemplate().delete(roleAuth);
        }
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -