Home
Object-relational mapping through orm.xml
As we have seen in this chapter, the object relational (o/r) mapping of an entity can be done through the use of annotations. As an alternative, you can specify the same information in an external file (called orm.xml) that must be packaged in the META-INF directory of the persistence module, or in a separate file packaged as a resource and defined in persistence.xml with the mapping-file element.
Example | 2-4 shows an extract of an orm.xml file that defines the Account entity.
Example 12-4 Extract of an orm.xml file to define an entity mapping
<entity-mappings .........><entity class="itso.bank.entity.Account" metadata-complete="true"name="Account"><description>Account of ITSO Bank</description><table name="ACCOUNT" schema="ITSO"></table><attributes><id name="accountNumber"><column name="id"/></id><basic name="balance"></basic><one-to-many name="transactionCollection"></one-to-many></attributes></entity>......</entity-mappings>
ibm.com/redbooks