src/com/lostfound/dao/impl/ReplyDaoImpl.java
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
package com.lostfound.dao.impl;
import java.sql.SQLException;
import java.util.List;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.lostfound.dao.ReplyDao;
import com.lostfound.model.Reply;
public class ReplyDaoImpl extends HibernateDaoSupport implements ReplyDao {
public void deleteBean(Reply bean) {
this.getHibernateTemplate().delete(bean);
this.getSession().beginTransaction().commit();
}
public void insertBean(Reply bean) {
this.getHibernateTemplate().save(bean);
this.getSession().beginTransaction().commit();
}
@SuppressWarnings("unchecked")
public Reply selectBean(String where) {
List<Reply> list = this.getHibernateTemplate().find("from Reply "+where);
if(list.size()==0){
return null;
}
return list.get(0);
}
public long selectBeanCount(final String where) {
long count = (Long)this.getHibernateTemplate().find(" select count(*) from Reply "+where).get(0);
return count;
}
@SuppressWarnings("unchecked")
public List<Reply> selectBeanList(final int start,final int limit,final String where) {
return (List<Reply>)this.getHibernateTemplate().executeFind(new HibernateCallback(){
public Object doInHibernate(final Session session) throws HibernateException, SQLException {
List<Reply> list = session.createQuery(" from Reply"+where).setFirstResult(start).setMaxResults(limit).list();
return list;
}
});
}
public void updateBean(Reply bean) {
this.getHibernateTemplate().update(bean);
this.getSession().beginTransaction().commit();
}
后面还有 6 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
