I'm not sure I understand this strange diagram ... In RegionLanguage there is some kind of foreign key pointing to Region.id, as I understand it? If there is only one column in the Region (as shown in the "diagram"), you can simply display only the "RegionLanguage", and you will have only one entity according to your desire - there is no information loss;).
But seriously, how would you like it to display? You want to have something like this:
class Region {
or something like this:
class RegionInnerJoinRegionLanguage {
In any case, you did not say how the other tables join your i18n tables. From your description, I assume that all tables have fk for RegionLanguage. I'm not sure what the Region table is used for in the great scheme of things. I think it’s just for grouping languages ... I think these are “models” of Switzerland (one “region” 4 languages) ... But what will you do with languages that speak several regions? You will have several French, English, etc. Languages (one for each region) and all the data multiplied for each of them?
I know that you are not asking for this ... I just think that you have simplified the data structure for this question ... So much so that it’s hard to guess what you really want to achieve.
Anyway, if you want to use a list of strings, you can try the following:
@ElementCollection @CollectionTable(name="RegionLanguage", joinColumns=@JoinColumn (name="regionID") // or whatever... it not on your diagram. ) @Column(name="langage") private List<String> langages;
I still do not understand why you want to put both tables in a single object ... If this is read-only data, you can try to create a view and display it --- always "exit";). But actually (both of them, in fact) are a little more complicated, in my opinion, this will bite you in the future. My advice is to just go with the “OneToMany Simple Display”.
source share