📄 commendhibernatedao.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: CommendHibernateDAO.java
package com.laoer.bbscs.dao.hibernate;
import com.laoer.bbscs.bean.Commend;
import com.laoer.bbscs.dao.ICommendDAO;
import java.sql.SQLException;
import java.util.List;
import net.sf.hibernate.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.hibernate.HibernateCallback;
import org.springframework.orm.hibernate.HibernateTemplate;
import org.springframework.orm.hibernate.support.HibernateDaoSupport;
public class CommendHibernateDAO extends HibernateDaoSupport
implements ICommendDAO
{
private static final Log logger;
private static final String LOAD_BY_POSTID = "from Commend commend where commend.postID = ? and commend.isBull = ?";
private static final String LOAD_NUM = "select count(commend.id) from Commend commend where commend.isBull = ?";
private static final String LOADS_BY_ISBULL = "from Commend commend where commend.isBull = ? order by commend.addTime desc";
private static final String LOAD_BY_ID = "from Commend commend where commend.id = ?";
private static final String LOAD_IN = "from Commend commend where commend.id in (:ids)";
static Class class$com$laoer$bbscs$dao$hibernate$CommendHibernateDAO; /* synthetic field */
public CommendHibernateDAO()
{
}
public Commend saveCommend(Commend commend)
{
getHibernateTemplate().saveOrUpdate(commend);
return commend;
DataAccessException ex;
ex;
logger.error(ex);
return null;
}
public Commend findCommendByPostID(long postID, short isBull)
{
Object o[] = {
new Long(postID), new Short(isBull)
};
List l = getHibernateTemplate().find("from Commend commend where commend.postID = ? and commend.isBull = ?", o);
if(l.size() == 0)
return null;
else
return (Commend)l.get(0);
}
public int getCommendNum(short isBull)
{
List l = getHibernateTemplate().find("select count(commend.id) from Commend commend where commend.isBull = ?", new Short(isBull));
return ((Integer)l.get(0)).intValue();
DataAccessException ex;
ex;
logger.error("getCommendNum(short isBull):" + ex);
return 0;
}
public List getCommendList(final short isBull, final int firstResult, int maxResults)
{
return getHibernateTemplate().executeFind(maxResults. new HibernateCallback() {
public Object doInHibernate(Session s)
throws HibernateException, SQLException
{
Query query = s.createQuery("from Commend commend where commend.isBull = ? order by commend.addTime desc");
query.setShort(0, isBull);
query.setFirstResult(firstResult);
query.setMaxResults(maxResults);
List list = query.list();
return list;
}
});
}
public List getCommendInList(List ids)
{
return getHibernateTemplate().executeFind(ids. new HibernateCallback() {
public Object doInHibernate(Session s)
throws HibernateException, SQLException
{
Query query = s.createQuery("from Commend commend where commend.id in (:ids)");
query.setParameterList("ids", ids);
List list = query.list();
return list;
}
});
}
public void removeCommend(long id)
{
getHibernateTemplate().execute(id. new HibernateCallback() {
public Object doInHibernate(Session s)
throws HibernateException, SQLException
{
s.delete("from Commend commend where commend.id = ?", new Long(id), Hibernate.LONG);
return null;
}
});
}
static Class class$(String x0)
{
return Class.forName(x0);
ClassNotFoundException x1;
x1;
throw new NoClassDefFoundError(x1.getMessage());
}
static
{
logger = LogFactory.getLog(class$com$laoer$bbscs$dao$hibernate$CommendHibernateDAO != null ? class$com$laoer$bbscs$dao$hibernate$CommendHibernateDAO : (class$com$laoer$bbscs$dao$hibernate$CommendHibernateDAO = class$("com.laoer.bbscs.dao.hibernate.CommendHibernateDAO")));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -