how to define <element-collection> for a List<String> field?

二次信任 提交于 2019-12-24 21:43:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!