Hi,
I'm designing a new feature which will have 4 tables as follows:
table: log_records table: feature1 mappings table: feature2 mappings table: unmapped
log records can contain 3 kinds of records: feature1, feature2 and remainder
The join between log_records and feature 1 will be col1, col2 The join beween log_records and feature 2 will be col1, col2, col3 and col4 The join will be exclusive ie if join log_records to feature1 by col1 and col2 then it could never be joined to feature2 Any records not found by joining to feature1 and feature2 will be inserted separately into table "unmapped"
Does this seem like a candidate for hibernate mappings?
I was able to define a @OneToMany in both feature1 and feature2 and join using @JoinColumns(@JoinColumn, @JoinColumn)
But I believe it's more usual to have the @OneToMany have just (mappedBy="") and not have the joincolumns
When I tried to use @JoinColumns (twice) in the log_records hibernate complained that columns were being declared more than once.
I suppose I would like to know if I'm on the right track. I have the unidirectional working But can't get the bi-directional working
I could possibly try with EmbeddedKey / Embeddable ? But will I have the same problems.
Thanks in advance
|