📄 bulletinhibernatedao.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: BulletinHibernateDAO.java
package com.laoer.bbscs.dao.hibernate;
import com.laoer.bbscs.bean.Bulletin;
import com.laoer.bbscs.dao.IBulletinDAO;
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 BulletinHibernateDAO extends HibernateDaoSupport
implements IBulletinDAO
{
private static final Log logger;
private static final String LOAD_ALL = "from Bulletin bull order by bull.id desc";
private static final String LOAD_COUNT = "select count(bull.id) from Bulletin bull";
private static final String LOAD_BY_ID = "from Bulletin bull where bull.id = ?";
static Class class$com$laoer$bbscs$bean$Bulletin; /* synthetic field */
static Class class$com$laoer$bbscs$dao$hibernate$BulletinHibernateDAO; /* synthetic field */
public BulletinHibernateDAO()
{
}
public Bulletin saveBulletin(Bulletin bulletin)
{
getHibernateTemplate().saveOrUpdate(bulletin);
return bulletin;
DataAccessException ex;
ex;
logger.error(ex);
return null;
}
public Bulletin getBulletin(long id)
{
return (Bulletin)getHibernateTemplate().get(class$com$laoer$bbscs$bean$Bulletin != null ? class$com$laoer$bbscs$bean$Bulletin : (class$com$laoer$bbscs$bean$Bulletin = class$("com.laoer.bbscs.bean.Bulletin")), new Long(id));
}
public int getBulletinNum()
{
List l = getHibernateTemplate().find("select count(bull.id) from Bulletin bull");
return ((Integer)l.get(0)).intValue();
DataAccessException ex;
ex;
logger.error(ex);
return 0;
}
public List getBulletinList(final int firstResult, int maxResults)
{
return getHibernateTemplate().executeFind(maxResults. new HibernateCallback() {
public Object doInHibernate(Session s)
throws HibernateException, SQLException
{
Query query = s.createQuery("from Bulletin bull order by bull.id desc");
query.setFirstResult(firstResult);
query.setMaxResults(maxResults);
List list = query.list();
return list;
}
});
}
public void removeBulletin(long id)
{
getHibernateTemplate().execute(id. new HibernateCallback() {
public Object doInHibernate(Session s)
throws HibernateException, SQLException
{
s.delete("from Bulletin bull where bull.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$BulletinHibernateDAO != null ? class$com$laoer$bbscs$dao$hibernate$BulletinHibernateDAO : (class$com$laoer$bbscs$dao$hibernate$BulletinHibernateDAO = class$("com.laoer.bbscs.dao.hibernate.BulletinHibernateDAO")));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -