问题
If my object has a
protected List<String> fileNote;
What is the right way to define that relationship in an orm.xml?
(note: I do not want to use annotations.)
回答1:
Most simple, if you are satisfied with defaults is:
<element-collection name="fileNote"/>
If more customization is needed, you can go further:
<element-collection name="fileNote" fetch="EAGER" access="FIELD/>
<column name="some_name_for_column_that_holds_note" />
<collection-table name="descriptive_name_for_table">
<join-column name="some_id" />
</collection-table>
</element-collection/>
来源:https://stackoverflow.com/questions/9808975/how-to-define-element-collection-for-a-liststring-field