@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Why we are using this annotations? 我需要知道这个自动递增的表 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");
}
}
是否有必要扩展域抽象类? 有什么用?