6.6.0.15.4: Modifying the map documentA map consists of mapping the model attributes and relationships to the schema. The map connects the object model description with the schema description. Once the map is defined, the persistence support for your data store is created during code generation. XMI vocabulary: Map.mapxmiAfter completing the top-down operation, the resulting map may need to be modified to fit existing data or models. This topic discusses the structure and vocabulary of an XMI map document. The following is a sample XMI code block from the map.mapxmi file that shows the mapping between the BankAccount CMP, and the BANKACCOUNT table. <ejbrdbmapping:EjbRdbDocumentRoot xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ejbrdbmapping="ejbrdbmapping.xmi" xmlns:Mapping="Mapping.xmi" xmlns:ejb="ejb.xmi" xmlns:RDBSchema="RDBSchema.xmi" xmlns:java="java.xmi" xmi:id="EjbRdbDocumentRoot_1" outputReadOnly="false" topToBottom="true"> <helper xsi:type="ejbrdbmapping:RdbSchemaProperies" xmi:id="RdbSchemaProperies_1" primitivesDocument="DB2UDBNT_V71"/> <inputs xsi:type="ejb:EJBJar" href="META-INF/ejb-jar.xml#ejb-jar_ID"/> <outputs xsi:type="RDBSchema:RDBDatabase" href="META-INF/Schema/Schema.dbxmi#TopDownDB_ID"/> <nested xsi:type="ejbrdbmapping:RDBEjbMapper" xmi:id="RDBEjbMapper_1"> <helper xsi:type="ejbrdbmapping:PrimaryTableStrategy" xmi:id="PrimaryTableStrategy_1"> <table href="META-INF/Schema/Schema.dbxmi#BankAccount"/> </helper> <inputs xsi:type="ejb:ContainerManagedEntity" href="META-INF/ejb-jar.xml#BankAccount"/> <outputs xsi:type="RDBSchema:RDBTable" href="META-INF/Schema/Schema.dbxmi#BankAccount"/> <nested xmi:id="BankAccount_accountNum---BankAccount_accountNum"> <inputs xsi:type="ejb:CMPAttribute" href="META-INF/ejb-jar.xml#BankAccount_accountNum"/> <outputs xsi:type="RDBSchema:RDBColumn" href="META-INF/Schema/Schema.dbxmi#RDBColumn_1"/> <typeMapping href="JavatoDB2UDBNT_V71TypeMaps.xmi#int-INTEGER"/> </nested> <nested xmi:id="BankAccount_customerName---BankAccount_customerName"> <helper xsi:type="ejbrdbmapping:EJBConverter" xmi:id="EJBConverter_1"> <targetClass href="java:/java.lang#String"/> <transformerClass href="java:/com.ibm.vap.converters#VapTrimStringConverter"/> </helper> <inputs xsi:type="ejb:CMPAttribute" href="META-INF/ejb-jar.xml#BankAccount_customerName"/> <outputs xsi:type="RDBSchema:RDBColumn" href="META-INF/Schema/Schema.dbxmi#RDBColumn_2"/> <typeMapping href="JavatoDB2UDBNT_V71TypeMaps.xmi#String-VARCHAR"/> </nested> <nested xmi:id="BankAccount_balance---BankAccount_balance"> <inputs xsi:type="ejb:CMPAttribute" href="META-INF/ejb-jar.xml#BankAccount_balance"/> <outputs xsi:type="RDBSchema:RDBColumn" href="META-INF/Schema/Schema.dbxmi#RDBColumn_3"/> <typeMapping href="JavatoDB2UDBNT_V71TypeMaps.xmi#BigDecimal-DECIMAL"/> </nested> </nested> <typeMapping xsi:type="Mapping:MappingRoot" href="JavatoDB2UDBNT_V71TypeMaps.xmi#Java_to_DB2UDBNT_V71_TypeMaps"/> </ejbrdbmapping:EjbRdbDocumentRoot> XML element descriptionshelper - defines helper objects that are used to set schema properties, table strategy, and as converters between attribute and column types. inputs - defines CMP references using an href tag that uses a path statement relative to the META-INF directory. outputs - defines database table references using an href tag that uses a path statement relative to the META-INF directory. nested - defines children mappings for attributes and columns. These mappings use the mapping object to describe the inputs, outputs, and helpers. typeMapping - an optional element in the map document. Adding mappingsThe procedure for adding a new mapping is easy if you use the following steps:
Make sure all of the id's chosen are unique in the entire document. |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|