我有具体的课本
public class Book extends Writte{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
@Column(name = "name")
String title;
@Column(name = "date")
Date date;
}
我有普通班,这个班有作者
public abstract class Writte {
@ManyToOne(cascade = {CascadeType.ALL}, fetch = FetchType.EAGER)
@JoinColumn(name="author_id")
Author author;
public void setAuthor(Author author){
this.author=author;
}
public Author getAuthor(){
return this.author;
}
}
我想建立一个工厂, 我不知道如何创建工厂,以便创建杂志,报纸,书籍等。
工厂应该服务吗?