?? elitehibernatedao.java
字號:
package com.laoer.bbscs.dao.hibernate;
import org.springframework.orm.hibernate.support.HibernateDaoSupport;
import com.laoer.bbscs.dao.IEliteDAO;
import com.laoer.bbscs.bean.Elite;
import java.util.*;
import org.springframework.dao.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* <p>Title: TianYi BBS</p>
* <p>Description: TianYi BBS System</p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: LAOER.COM/TIANYISOFT.NET</p>
* @author laoer
* @version 6.0
*/
public class EliteHibernateDAO
extends HibernateDaoSupport
implements IEliteDAO {
private static final Log logger = LogFactory.getLog(EliteHibernateDAO.class);
private static final String LOADS_PIDRID =
"from Elite elite where elite.pid = ? and elite.rootID = ? order by elite.orders";
public EliteHibernateDAO() {
super();
}
/**
*
* @param elite Elite
* @return Elite
* @todo Implement this com.laoer.bbscs.dao.IEliteDAO method
*/
public Elite saveElite(Elite elite) {
try {
this.getHibernateTemplate().saveOrUpdate(elite);
return elite;
}
catch (DataAccessException ex) {
logger.error(ex);
return null;
}
}
/**
*
* @param id long
* @return Elite
* @todo Implement this com.laoer.bbscs.dao.IEliteDAO method
*/
public Elite getElite(long id) {
return (Elite)this.getHibernateTemplate().get(Elite.class, new Long(id));
}
/**
*
* @param pid long
* @param rootID long
* @return List
* @todo Implement this com.laoer.bbscs.dao.IEliteDAO method
*/
public List findEliteByPidRid(long pid, long rootID) {
Object[] o = {
new Long(pid), new Long(rootID)};
try {
return this.getHibernateTemplate().find(LOADS_PIDRID, o);
}
catch (DataAccessException ex) {
logger.error(ex);
return new ArrayList();
}
}
/**
*
* @param elite Elite
* @todo Implement this com.laoer.bbscs.dao.IEliteDAO method
*/
public void removeElite(Elite elite) {
this.getHibernateTemplate().delete(elite);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -