【Java开源代码栏目提醒】:以下是网学会员为您推荐的Java开源代码-ActionDAOHibernate.java,希望本篇文章对您学习有所帮助。
package org.appfuse.dao.hibernate;
import java.util.List;
import org.springframework.orm.ObjectRetrievalFailureException;
import org.appfuse.dao.*;
import org.appfuse.model.Action;
import org.appfuse.util.exception.AppDAOException;
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 ActionDAOHibernate
extends BaseDAOHibernate
implements ActionDAO {
public Action getAction(int actionid) throws AppDAOException {
Action action = (Action) getHibernateTemplate().get(Action.class,
new Integer(actionid));
if (action == null) {
throw new ObjectRetrievalFailureException(Action.class,
new Integer(actionid));
}
return action;
}
public List getActions(Action action) throws AppDAOException {
return getHibernateTemplate().find(
"from Action");
}
public void saveAction(final Action action) throws AppDAOException {
getHibernateTemplate().saveOrUpdate(action);
getHibernateTemplate().flush();
}
public void removeAction(int actionid) throws AppDAOException {
Action action = getAction(actionid);
getHibernateTemplate().delete(action);
}
}