@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
为什么我们使用此注释?我需要知道这是否会自动增加我的表ID值。(GenerationType.IDENTITY)还有什么其他类型,当我们使用此批注时实际发生了什么
public class Author extends Domain
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "name")
private String name;
@Column(name = "address")
private String address;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "authorId")
private List<Book>
bookList;
public Author()
{
setServiceClassName("wawo.tutorial.service.admin.AuthorService");
}
}
*是否有必要扩展Domain抽象类?有什么用?