@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抽象类?有什么用?