| <html><head> |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| <title>3. Meet-in-the-Middle Mapping</title><link rel="stylesheet" href="css/docbook.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.72.0"><link rel="start" href="manual.html" title="Apache OpenJPA User's Guide"><link rel="up" href="ref_guide_mapping.html" title="Chapter 7. Mapping"><link rel="prev" href="ref_guide_pc_reverse.html" title="2. Reverse Mapping"><link rel="next" href="ref_guide_mapping_defaults.html" title="4. Mapping Defaults"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">3. |
| Meet-in-the-Middle Mapping |
| </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ref_guide_pc_reverse.html">Prev</a> </td><th width="60%" align="center">Chapter 7. |
| Mapping |
| </th><td width="20%" align="right"> <a accesskey="n" href="ref_guide_mapping_defaults.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ref_guide_mapping_middle"></a>3. |
| Meet-in-the-Middle Mapping |
| </h2></div></div></div><a class="indexterm" name="d0e25606"></a><a class="indexterm" name="d0e25609"></a><a class="indexterm" name="d0e25614"></a><p> |
| In the <span class="emphasis"><em>meet-in-the-middle</em></span> |
| mapping approach, you control both the relational model and the object model. It |
| is up to you to define the mappings between these models. The mapping |
| tool's <code class="literal">validate</code> action is useful to meet-in-the-middle |
| mappers. This action verifies that the mapping information for a class matches |
| the class definition and the existing schema. It throws an informative exception |
| when your mappings are incorrect. |
| </p><div class="example"><a name="ref_guide_mapping_mappingtool_validate"></a><p class="title"><b>Example 7.11. |
| Validating Mappings |
| </b></p><div class="example-contents"><pre class="programlisting"> |
| java org.apache.openjpa.jdbc.meta.MappingTool -action validate Magazine.java |
| </pre></div></div><br class="example-break"><p> |
| The <code class="literal">buildSchema</code> action we discussed in |
| <a href="ref_guide_mapping.html#ref_guide_mapping_mappingtool" title="1. Forward Mapping">Section 1, “ |
| Forward Mapping |
| ”</a> is also somewhat useful |
| during meet-in-the-middle mapping. Unlike the <code class="literal">validate</code> |
| action, which throws an exception if your mapping data does not match the |
| existing schema, the <code class="literal">buildSchema</code> action assumes your mapping |
| data is correct, and modifies the schema to match your mappings. This lets you |
| modify your mapping data manually, but saves you the hassle of using your |
| database's tools to bring the schema up-to-date. |
| </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ref_guide_pc_reverse.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ref_guide_mapping.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ref_guide_mapping_defaults.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2. |
| Reverse Mapping |
| </td><td width="20%" align="center"><a accesskey="h" href="manual.html">Home</a></td><td width="40%" align="right" valign="top"> 4. |
| Mapping Defaults |
| </td></tr></table></div></body></html> |