habe ich Klasse Geld, das ist ein @EmbeddableNested embeddable - AttributeOverride für integrierbare innerhalb embeddable
@Embeddable
public class Money implements Serializable, Comparable<Money> {
@Column(name = "amount", precision = 15, scale = 2)
private BigDecimal amount;
}
Wenn ich mehrere Mal innerhalb Einheit USEIT, funktioniert alles einwandfrei. Zum Beispiel
@Entity
public class SomeEntity implements Serializable {
@Embedded
@AttributeOverride(name = "amount", column = @Column(name = "entry"))
private Money entryValue;
@Embedded
@AttributeOverride(name = "amount", column = @Column(name = "leave"))
private Money leaveValue;
}
Code oben funktioniert perfekt.
Jetzt tritt das Problem auf, wenn ich ein anderes @Embeddable habe, dass ich Money-Instanzen darin haben möchte und dass @Embeddable von einer Entität mehrere Male benutzt wird. Beispiel:
Fähiges
@Embeddable public class ReportCostValues implements Serializable { @Embedded @AttributeOverride(name = "amount", column = @Column(name = "covered_by_grant")) private Money coveredByGrant; @Embedded @AttributeOverride(name = "amount", column = @Column(name = "own_resources")) private Money foundedFromOwnResources; @Embedded @AttributeOverride(name = "amount", column = @Column(name = "personal_contribution")) private Money personalContribution;
Entity
@Entity public class ReportCostEntity implements Identifiable<Long>, Serializable { @Id private Long id; @Embedded private ReportCostValues contracted; @Embedded private ReportCostValues current; @Embedded private ReportCostValues previousReport;
Dieser Code oben wird nicht funktionieren. Irgendwelche Ideen, wie man dieses Problem angeht?
es hat funktioniert, vielen Dank! –
@PaulSzulc Sie sind willkommen –