基本信息
源码名称:ssh框架 全注解编程
源码大小:0.05M
文件格式:.doc
开发语言:Java
更新时间:2015-04-08
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍
对有一定ssh框架基础的同学有一定帮助

//当前的类是一个持久化类,是Category这个类。他映射了一个表category。所对应的 数据库是users

//这句:@Table(name = "category", catalog = "users")  可以省略

@Entity

@Table(name = "category", catalog = "users")

public class Category implements java.io.Serializable {

 private static final long serialVersionUID = 3240281547213597385L;

 private Integer id;

 private String name;

 private String description;

 private Set<Product> products = new HashSet<Product>(0);

 

 public Category() {

 }

 public Category(String name, String description, Set<Product> products) {

  this.name = name;

  this.description = description;

  this.products = products;

 }

 // 主键 :@Id    主键生成方式:strategy = "increment"

 //映射表中id这个字段,不能为空,并且是唯一的

 @GenericGenerator(name = "generator", strategy = "increment")

 @Id

 @GeneratedValue(generator = "generator")

 @Column(name = "id", unique = true, nullable = false)

 public Integer getId() {

  return this.id;

 }

 public void setId(Integer id) {

  this.id = id;

 }

 //映射表中name这个字段 ,长度是500

 @Column(name = "name", length = 500)

 public String getName() {

  return this.name;

 }

 public void setName(String name) {

  this.name = name;

 }

 

 //映射表中description这个字段 ,长度是500

 @Column(name = "description", length = 500)

 public String getDescription() {

  return this.description;

 }