9.5 Defining the mapping information between the database and Java objects
With Cosminexus JPA Provider, you can define the information for mapping the database and the Java objects. You define the mapping information with an annotation or the O/R mapping file.
-
Definition using an annotation
You define the mapping information directly in the entity class of the application.
-
Definition using an O/R mapping file
An O/R mapping file is an XML file used for describing the mapping information. You use tags to define the mapping information.
If the mapping information is defined in both annotations and O/R mapping file, the definition in the O/R mapping file is given priority. Therefore, if you use the O/R mapping file to change the mapping information defined by using annotations, you can change the mapping information without changing the application.
Determine whether you want to use an annotation or an O/R mapping file or you want to use the annotation and O/R mapping file together, in accordance with the application creation policy.