Pessoal,
Estou com o seguinte problema.
Tenho uma Classe A que tem uma lista de elementos da Classe B e a classe B por sua vez tem uma lista de elementos da Classe C.
Estou fazendo o mapeamento da seguinte forma:
############################
@Entity
@Table(name=“Ponto”)
public class Ponto {
private Long Id;
private Set<Vazao> VazaoList;
public Ponto()
{}
public void setId(Long id) {
this.Id = id;
}
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Long getId() {
return Id;
}
public void setVazaoList(Set<Vazao> vazaoList) {
VazaoList = vazaoList;
}
@OneToMany(mappedBy="ponto", fetch= FetchType.LAZY)
public Set<Vazao> getVazaoList() {
return VazaoList;
}
}
############################
@Entity
@Table(name=“Vazao”)
public class Vazao {
private Ponto Ponto;
private Long Id;
private Set<Bombeamento> BombeamentoList;
public Vazao()
{}
public void setPonto(Ponto ponto) {
Ponto = ponto;
}
@ManyToOne
@JoinColumn(name="ponto_fk",nullable=false)
public Ponto getPonto() {
return Ponto;
}
public void setId(Long id) {
this.Id = id;
}
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Long getId() {
return Id;
}
public void setBombeamentoList(Set<Bombeamento> bombeamentoList) {
BombeamentoList= bombeamentoList;
}
@OneToMany(mappedBy="vazao", fetch= FetchType.LAZY)
public Set<Bombeamento> getBombeamentoList() {
return BombeamentoList;
}
}
###########################
@Entity
@Table(name=“Bombeamento”)
public class Bombeamento {
private Vazao Vazao;
private Long Id;
public Bombeamento ()
{}
public void setVazao(Vazao vazao) {
Vazao= vazao;
}
@ManyToOne
@JoinColumn(name="vazao_fk",nullable=false)
public Vazao getVazao() {
return Vazao;
}
public void setId(Long id) {
this.Id = id;
}
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Long getId() {
return Id;
}
}
O erro gerado:
Exception in thread “main” org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: br.com.testehibernate.Bombeamento.vazao in br.com.testehibernate.Vazao.bombeamentoList
at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:655)
at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:619)
at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:66)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1221)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:383)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1377)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954)
at br.com.testehibernate.GeraBanco.main(GeraBanco.java:12)
Todas as classes estão mapeadas no hibernate.cfg.xml.
Alguém poderia me ajudar ?
Vlw abs !!!