hibernate注解创建表总是失败,显示表不存在

import java.io.Serializable;
import javax.persistence.*; 

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name="student")
public class Student implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
	
	private int id;
	
	private String name;
	
	@Id              // 表示主键
    @GenericGenerator(name="generator", strategy="increment")
	@GeneratedValue(generator="generator")   // 自增长
    @Column(name="id")
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}
	
	//@Column(name="name") 
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}


注解配置错误,上面这个配置可以。注意id是int型的,如果设置增长类型为uuid,则为string


posted on 2015-05-31 19:32  长456风  阅读(629)  评论(0编辑  收藏  举报

导航