0

我有两节课

Alocacao 和 Responsavel

我有一个 1:n

响应类

@Entity
@Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
@Table(name="Responsavel")
public class Responsavel {

@Id
@Column(name="idResp")
private int idResp;

@Column(name="nomeResp")
private String nomeResp;

@Column(name="emailResp")
private String email;

@ManyToOne(fetch=FetchType.EAGER)
@JoinColumn(name="idGrupResp")
private GrupoResponsavel grupo;

@Column(name="idPovUser")
private int povUser;

@ManyToMany(mappedBy="responsavel", fetch=FetchType.EAGER)
private List<TarefaBackLog> tarefa;

public Responsavel() {
    super();
}
//getters and setters

Alocacao 类

@Entity
@Table(name = "responsavel_alocacao")
public class Alocacao {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name = "idRespAloc")
private int idAlocacao;

@ManyToOne
@JoinColumn(name="idResponsavel", referencedColumnName="idResp")
private Responsavel idResponsavel;

@JoinColumn(name="idPeriodo")
private PeriodoPov idPeriodo;

@Column(name="Alocacao")
private double alocacao;
//getters and setters

但是当我尝试使用“findAll()”获取所有 Alocacao 对象时,它会给 idPeriodo 和 idResponsavel 带来空值。有什么想法吗?

谢谢

4

0 回答 0