0
我有複雜映射的實體,我沒有註釋權。休眠複雜集合映射問題
這裏是實體:
@Entity
@Table(name = "bank")
class Bank {
@Column(name = "type")
int type
@ElementCollection
@CollectionTable(name = "bank_fp", joinColumns = @JoinColumn(name = "bank_id"))
@MapKeyColumn(name = "finance_percent")
Map<Double, BankRates>
}
? embeddable or entity ?
class BankRates {
@ElementCollection
@CollectionTable(name = "bankrates", joinColumns = @JoinColumn(name = "bfp_id"))
@MapKeyColumn(name = "track_class")
Map<String, TrackRates>
}
? embeddable or entity ?
class TrackRates {
? how to map ?
Map<YearsRange, Double>
}
@Embeddable
@Access(AccessType.FIELD)
class YearsRange {
@Column(name = "from")
int from
@Column(name = "to")
int to
}
在我看來,這些都是表:
Bank: id, type
bank_fp: id, bank_id, finance_percent - table for the map in the bank entity
bank_rates: bfp_id, track_class, from, to, rate - table for BankRates, TrackRates, YearsRange all embedded in a single table cuz its only mappings
你們誰是Hibernate映射superbs 請幫助。