使用SpringSide 3.1.4.3开发Web项目的全过程(上)
2009-09-24 00:00:00 来源:WEB开发网Comment.java如下:
package personal.youxia.entity.entities;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import personal.youxia.entity.IdEntity;
@Entity
// 表名与类名不相同时重新定义表名.
@Table(name = "comments")
// 默认的缓存策略.
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Comment extends IdEntity {
private String content;
private Long articleId;
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
@Column(name = "article_id")
public Long getArticleId() {
return articleId;
}
public void setArticleId(Long articleId) {
this.articleId = articleId;
}
}
编写Dao层代码,ArticleDao.java如下:
package personal.youxia.dao;
import org.springside.modules.orm.hibernate.HibernateDao;
import personal.youxia.entity.Article;
public class ArticleDao extends HibernateDao<Article, Long> {
}
Tags:使用 SpringSide 开发
编辑录入:爽爽 [复制链接] [打 印]更多精彩
赞助商链接