I have an entity with two Embedded
classes of the same type and which one has an ElementCollection
of the same type two. The business logic is apparently correct, but I am experiencing some problems with lack of knowledge in JPA, I guess.
Let's check my classes:
@Entity
public class Etapa extends EntidadeBase {
@Embedded
private CronogramaDeDesembolso cronogramaDeReceita;
@Embedded
private CronogramaDeDesembolso cronogramaDeDespesa;
}
@Embeddable
public class CronogramaDeDesembolso {
@ElementCollection
private List<Parcela> parcelas;
}
I am receiving the following error log.
Caused by: org.hibernate.HibernateException: Found shared references to a collection: nexxus.convenioestadual.dominio.planodetrabalho.etapa.Etapa.cronogramaDeReceita.parcelas
Do you guys have any clue of what is wrong and how can I fix it?
EDIT:
Due comments I did this edit and it do not worked too
@Entity
public class Etapa extends EntidadeBase {
@Embedded
@AttributeOverride(name = "parcelas", column = @Column(name = "parcelasReceita"))
private CronogramaDeDesembolso cronogramaDeReceita;
@Embedded
@AttributeOverride(name = "parcelas", column = @Column(name = "parcelasDespesa"))
private CronogramaDeDesembolso cronogramaDeDespesa;
}