spring_150910_hibernate_id_auto

package com.spring.model;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name="t_dog")
public class DogPet {
    
    private int id;
    private String name;
    private int age;
    private String kind;
    private String sex;
    private String health;
    
    @Id  
    @GeneratedValue(strategy = GenerationType.AUTO)
    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
    public String getKind() {
        return kind;
    }
    public void setKind(String kind) {
        this.kind = kind;
    }
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
    public String getHealth() {
        return health;
    }
    public void setHealth(String health) {
        this.health = health;
    }
    
    public String toString()
    {
        return id+"--"+name+"--"+kind+"--"+age+"--"+health;
    }
}

 

posted @ 2015-09-27 13:37  奋斗?坑  阅读(148)  评论(0编辑  收藏  举报