91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

Git的使用,使用Eclipse進行Web開發,期末論文(簡易博客系統)

資源截圖

代碼片段和文件信息

package?org.xpy.dao;

import?java.util.List;

import?org.hibernate.Session;
import?org.hibernate.SessionFactory;
import?org.hibernate.criterion.Restrictions;
import?org.springframework.beans.factory.annotation.Autowired;
import?org.springframework.stereotype.Repository;
import?org.xpy.domain.Blog;
import?org.xpy.domain.Blogger;

@Repository
public?class?BlogDAO?{
@Autowired
SessionFactory?sessionFactory;

public?SessionFactory?getSessionFactory()?{
return?sessionFactory;
}

public?void?setSessionFactory(SessionFactory?sessionFactory)?{
this.sessionFactory?=?sessionFactory;
}

public?BlogDAO()?{
}

public?BlogDAO(SessionFactory?sessionFactory)?{
super();
this.sessionFactory?=?sessionFactory;
}

Session?currentSession()?{
return?sessionFactory.getCurrentSession();
}

@SuppressWarnings(“unchecked“)
public?List?getBlogsForBlogger(long?bloggerid)?{
return?(List)?currentSession().createQuery(“from?Blog?where?blogger_id?=??“).setParameter(0?bloggerid)
.list();
}

public?Blog?getBlogById(long?blogid)?{
return?(Blog)?currentSession().createQuery(“from?Blog?where?id?=??“).setParameter(0?blogid).uniqueResult();
}

public?void?addBlog(Blogger?blogger?Blog?blog)?{
blog.setBlogger(blogger);
currentSession().save(blog);
}

public?void?delBlog(long?blogid)?{
//?解除多對一關聯再刪除,一對多關聯不用解除,級聯刪除即可
Blog?blog?=?getBlogById(blogid);
blog.getBlogger().getBlogs().remove(blog);
blog.setBlogger(null);
currentSession().delete(blog);
}

public?void?updateBlog(Blog?blog)?{
currentSession().update(blog);
}

/*
?*?@param?numCount?每頁多少條記錄
?*?
?*?@param?pageCount?分多少頁
?*/
@SuppressWarnings(“unchecked“)
public?List?getBlogsByPage(long?bloggerid?int?numCount?int?pageCount)?{
//?計算偏移值
final?int?offset?=?(pageCount?-?1)?*?numCount;
List?blogs?=?currentSession().createCriteria(Blog.class).add(Restrictions.eq(“blogger.id“?bloggerid))
.setFirstResult(offset).setMaxResults(numCount).list();
return?blogs;
}

public?void?flush()?{
currentSession().flush();
}
}

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-06-08?17:26??xpy-root\
?????目錄???????????0??2018-06-09?23:43??xpy-root\.git\
?????文件??????????21??2018-06-08?17:48??xpy-root\.git\COMMIT_EDITMSG
?????文件?????????338??2018-05-30?18:09??xpy-root\.git\config
?????文件??????????73??2018-05-30?18:09??xpy-root\.git\description
?????文件?????????106??2018-06-07?15:35??xpy-root\.git\FETCH_HEAD
?????文件??????????23??2018-06-07?15:21??xpy-root\.git\HEAD
?????目錄???????????0??2018-05-30?18:09??xpy-root\.git\hooks\
?????文件?????????478??2018-05-30?18:09??xpy-root\.git\hooks\applypatch-msg.sample
?????文件?????????896??2018-05-30?18:09??xpy-root\.git\hooks\commit-msg.sample
?????文件?????????189??2018-05-30?18:09??xpy-root\.git\hooks\post-update.sample
?????文件?????????424??2018-05-30?18:09??xpy-root\.git\hooks\pre-applypatch.sample
?????文件????????1642??2018-05-30?18:09??xpy-root\.git\hooks\pre-commit.sample
?????文件????????1348??2018-05-30?18:09??xpy-root\.git\hooks\pre-push.sample
?????文件????????4951??2018-05-30?18:09??xpy-root\.git\hooks\pre-rebase.sample
?????文件????????1239??2018-05-30?18:09??xpy-root\.git\hooks\prepare-commit-msg.sample
?????文件????????3611??2018-05-30?18:09??xpy-root\.git\hooks\update.sample
?????文件???????21280??2018-06-08?17:48??xpy-root\.git\index
?????目錄???????????0??2018-05-30?18:09??xpy-root\.git\info\
?????文件?????????240??2018-05-30?18:09??xpy-root\.git\info\exclude
?????目錄???????????0??2018-05-30?18:09??xpy-root\.git\logs\
?????文件????????5087??2018-06-08?17:48??xpy-root\.git\logs\HEAD
?????目錄???????????0??2018-05-30?18:09??xpy-root\.git\logs\refs\
?????目錄???????????0??2018-06-07?15:13??xpy-root\.git\logs\refs\heads\
?????文件????????4432??2018-06-08?17:48??xpy-root\.git\logs\refs\heads\master
?????文件?????????468??2018-06-07?15:21??xpy-root\.git\logs\refs\heads\testbr
?????目錄???????????0??2018-05-30?18:09??xpy-root\.git\logs\refs\remotes\
?????目錄???????????0??2018-05-30?18:16??xpy-root\.git\logs\refs\remotes\origin\
?????文件?????????188??2018-05-30?18:09??xpy-root\.git\logs\refs\remotes\origin\HEAD
?????文件????????3292??2018-06-08?17:49??xpy-root\.git\logs\refs\remotes\origin\master
?????目錄???????????0??2018-06-08?17:48??xpy-root\.git\objects\
............此處省略905個文件信息

評論

共有 條評論