• 大小: 843KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-08
  • 语言: 其他
  • 标签: bbs论坛  

资源简介

基于SSH的bbs论坛(源代码)

资源截图

代码片段和文件信息

package com.tjpu.dao;


import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.criterion.Example;

import com.tjpu.hibernate.BArticle;
import com.tjpu.hibernate.BForum;
import com.tjpu.hibernate.BUser;
import com.tjpu.hibernate.baseHibernateDAO;
import com.tjpu.hibernate.HibernateSessionFactory;

public class BArticleDAO extends baseHibernateDAO {
private static final Log log = LogFactory.getLog(BArticleDAO.class);
// property constants
public static final String _ANICKNAME = “ANickname“;
public static final String _ADEPCODE = “ADepcode“;
public static final String _Atitle = “Atitle“;
public static final String _ACONTENT = “AContent“;
public static final String _ANEWSFLAG = “ANewsflag“;
public static final String _ABROWSEAMOUNT = “ABrowseamount“;
public static final String _ARESPONSEAMOUNT = “AResponseamount“;
public static final String _ALATESTRESPONSER = “ALatestresponser“;

public void save(BArticle article) {
log.debug(“saving BArticle instance“);
Session session = HibernateSessionFactory.getSession();
try {
session.beginTransaction();
session.save(article);
session.getTransaction().commit();
session.flush();
session.clear();
log.debug(“save successful“);
} catch (RuntimeException re) {
log.error(“save failed“ re);
session.getTransaction().rollback();
throw re;
} finally {
HibernateSessionFactory.closeSession(session);
}
}

public void update(BArticle article) {
log.debug(“updating BArticle instance“);
Session session = HibernateSessionFactory.getSession();
try {
session.beginTransaction();
session.update(article);
session.getTransaction().commit();
session.flush();
session.clear();
log.debug(“update successful“);
} catch (RuntimeException re) {
log.error(“update failed“ re);
session.getTransaction().rollback();
throw re;
} finally {
HibernateSessionFactory.closeSession(session);
}
}

public void mySave(BArticle articleString cidInteger fid) {
log.debug(“saving BArticle instance“);
Session session = HibernateSessionFactory.getSession();
try {
session.beginTransaction();
BUser user=(BUser) session.get(BUser.class cid);
article.setBUser(user);
BForum forum=(BForum) session.get(BForum.class fid);
article.setBForum(forum);
session.save(article);
session.getTransaction().commit();
session.flush();
session.clear();
log.debug(“save successful“);
} catch (RuntimeException re) {
log.error(“save failed“ re);
session.getTransaction().rollback();
throw re;
} finally {
HibernateSessionFactory.closeSession(session);
}
}

public void delete(BArticle persistentInstance) {
log.debug(“deleting BArticle instance“);
try {
getSession().delete(p

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        928  2012-05-26 15:51  BBSLife\.classpath

     文件        517  2010-10-11 09:14  BBSLife\.myhibernatedata

     文件        294  2012-05-26 15:51  BBSLife\.mymetadata

     文件        255  2010-10-11 09:14  BBSLife\.mystrutsdata

     文件       2035  2012-05-26 15:55  BBSLife\.project

     文件        500  2012-05-26 15:55  BBSLife\.settings\.jsdtscope

     文件        978  2010-10-11 11:01  BBSLife\.settings\org.eclipse.core.resources.prefs

     文件        395  2012-05-26 15:51  BBSLife\.settings\org.eclipse.jdt.core.prefs

     文件        459  2012-05-26 15:51  BBSLife\.settings\org.eclipse.wst.common.component

     文件        252  2012-05-26 15:55  BBSLife\.settings\org.eclipse.wst.common.project.facet.core.xml

     文件         49  2012-05-26 15:55  BBSLife\.settings\org.eclipse.wst.jsdt.ui.superType.container

     文件          6  2012-05-26 15:55  BBSLife\.settings\org.eclipse.wst.jsdt.ui.superType.name

     文件       5681  2010-10-11 09:14  BBSLife\src\com\tjpu\dao\BArticleDAO.java

     文件       6163  2010-10-11 09:14  BBSLife\src\com\tjpu\dao\BForumDAO.java

     文件       5806  2010-10-11 09:14  BBSLife\src\com\tjpu\dao\BManagerDAO.java

     文件       4185  2010-10-11 09:14  BBSLife\src\com\tjpu\dao\BResponseDAO.java

     文件       7583  2010-10-11 09:14  BBSLife\src\com\tjpu\dao\BRightDAO.java

     文件       8655  2010-10-11 09:14  BBSLife\src\com\tjpu\dao\BUserDAO.java

     文件       4188  2010-10-11 09:14  BBSLife\src\com\tjpu\dao\LogDAO.java

     文件       3548  2010-10-11 09:14  BBSLife\src\com\tjpu\hibernate\BArticle.hbm.xml

     文件       4454  2010-10-11 09:14  BBSLife\src\com\tjpu\hibernate\BArticle.java

     文件        315  2010-10-11 09:14  BBSLife\src\com\tjpu\hibernate\baseHibernateDAO.java

     文件       1972  2010-10-11 09:14  BBSLife\src\com\tjpu\hibernate\BForum.hbm.xml

     文件       2225  2010-10-11 09:14  BBSLife\src\com\tjpu\hibernate\BForum.java

     文件        789  2010-10-11 09:14  BBSLife\src\com\tjpu\hibernate\BManager.hbm.xml

     文件        792  2010-10-11 09:14  BBSLife\src\com\tjpu\hibernate\BManager.java

     文件       2113  2010-10-11 09:14  BBSLife\src\com\tjpu\hibernate\BResponse.hbm.xml

     文件       1994  2010-10-11 09:14  BBSLife\src\com\tjpu\hibernate\BResponse.java

     文件       1852  2010-10-11 09:14  BBSLife\src\com\tjpu\hibernate\BRight.hbm.xml

     文件       1836  2010-10-11 09:14  BBSLife\src\com\tjpu\hibernate\BRight.java

............此处省略302个文件信息

评论

共有 条评论