|  | <html><head> | 
|  | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> | 
|  | <title>11.  Default Schema</title><link rel="stylesheet" href="css/docbook.css" type="text/css"><base href="display"><meta name="generator" content="DocBook XSL Stylesheets V1.72.0"><link rel="start" href="manual.html" title="Apache OpenJPA 2.0 User's Guide"><link rel="up" href="ref_guide_dbsetup.html" title="Chapter 4.  JDBC"><link rel="prev" href="ref_guide_dbsetup_lrs.html" title="10.  Large Result Sets"><link rel="next" href="ref_guide_schema_info.html" title="12.  Schema Reflection"></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">11.  | 
|  | Default Schema | 
|  | </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ref_guide_dbsetup_lrs.html">Prev</a> </td><th width="60%" align="center">Chapter 4.  | 
|  | JDBC | 
|  | </th><td width="20%" align="right"> <a accesskey="n" href="ref_guide_schema_info.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_schema_def"></a>11.  | 
|  | Default Schema | 
|  | </h2></div></div></div><a class="indexterm" name="d0e24185"></a><p> | 
|  | It is common to duplicate a database model in multiple schemas. You may have one | 
|  | schema for development and another for production, or different database users | 
|  | may access different schemas. OpenJPA facilitates these patterns with the | 
|  | <a href="ref_guide_conf_jdbc.html#openjpa.jdbc.Schema" title="6.12.  openjpa.jdbc.Schema"><code class="literal">openjpa.jdbc.Schema</code> | 
|  | </a> configuration property. This property establishes a default schema for | 
|  | any unqualified table names, allowing you to leave schema names out of your | 
|  | mapping definitions. | 
|  | </p><p> | 
|  | The <code class="literal">Schema</code> property also establishes the default schema for | 
|  | new tables created through OpenJPA tools, such as the mapping tool covered in | 
|  | <a href="ref_guide_mapping.html#ref_guide_mapping_mappingtool" title="1.  Forward Mapping">Section 1, “ | 
|  | Forward Mapping | 
|  | ”</a>. | 
|  | </p><p> | 
|  | If the entities are mapped to the same table name but with different schema | 
|  | name within one <code class="literal">PersistenceUnit</code> intentionally, and the | 
|  | strategy of <code class="literal">GeneratedType.AUTO</code> is used to generate the ID | 
|  | for each entity, a schema name for each entity must be explicitly declared | 
|  | either through the annotation or the mapping.xml file. Otherwise, the mapping | 
|  | tool only creates the tables for those entities with the schema names under | 
|  | each schema. In addition, there will be only one | 
|  | <code class="literal">OPENJPA_SEQUENCE_TABLE</code> created for all the entities within | 
|  | the <code class="literal">PersistenceUnit</code> if the entities are not identified | 
|  | with the schema name. | 
|  | Read <a href="ref_guide_sequence.html" title="6.  Generators">Section 6, “ | 
|  | Generators | 
|  | ”</a> in the Reference Guide. | 
|  | </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ref_guide_dbsetup_lrs.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ref_guide_dbsetup.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ref_guide_schema_info.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">10.  | 
|  | Large Result Sets | 
|  |  </td><td width="20%" align="center"><a accesskey="h" href="manual.html">Home</a></td><td width="40%" align="right" valign="top"> 12.  | 
|  | Schema Reflection | 
|  | </td></tr></table></div></body></html> |