First of all, we need to understand the metadata-collection process, from both annotation and XML file.
- 1. Process the annotation.
- 2. Add the classes defined in XML. Override if the class-level metadata if existed in annotation.
- 3. Add the attribute mappings defined in XML. Override if the attribute-level metadata if existed in annotation.
- 4. Apply defaults.
Step1: To employing XML mapping in JPA, we need to create a orm.xml fle
XML definition Example
Step2: add xml definition in persistence.xml:
org.hibernate.ejb.HibernatePersistence orm.xml
0 comments:
Post a Comment