我有1对多的关系
@Entity
@Table(name = "job")
public class JobBean implements Serializable{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id", updatable = false, nullable = false)
private Long id;
@Column(name = "name")
protected String name;
@Column(name = "state")
protected String state;
.......
@Entity
@Table(name = "task")
public class TaskBean implements Serializable{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "tid", updatable = false, nullable = false)
protected Long tid;
@Column(name = "id")
protected Long id;
@Column(name = "state")
protected String state;
@Column(name = "progress")
protected int progress;
在Task中,id是来自Job的外键。
我想获得所有工作及其相关任务。我的hibernate util怎么样?