The hibernate documentation says:
A unidirectional one-to-many association on a foreign key is a very unusual case, and is not really recommended.
... We think it's better to use a join table for this kind of association.
.
What's the problem in it? Is there any tecnical issue?
My situation: 1 customer have 0 or more budget.
Code:
public class Customer extends Persistente {
private String nome;
private List<Orcamento> orcamentos;
public Cliente() {}
public Cliente(String nome) {
this.nome = nome;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public List<Orcamento> getOrcamentos() {
return orcamentos;
}
public void setOrcamentos(List<Orcamento> orcamentos) {
this.orcamentos = orcamentos;
}
}
public abstract class Persistente {
protected int id;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}