blob: 536726a1fd7a83173860d38e4cdbc9e00feeee22 [file] [log] [blame]
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title xmlns:d="http://docbook.org/ns/docbook">Chapter&nbsp;20.&nbsp;Filtering</title><link rel="stylesheet" type="text/css" href="css/cayenne-doc.css"><meta xmlns:d="http://docbook.org/ns/docbook" name="keywords" content="Cayenne 4.0 documentation"><meta xmlns:d="http://docbook.org/ns/docbook" name="description" content="User documentation for Apache Cayenne version 4.0"><link rel="home" href="index.html" title="Cayenne Guide"><link rel="up" href="cayenne-guide-part4.html" title="Part&nbsp;IV.&nbsp;DB-First Flow"><link rel="prev" href="re-introduction.html" title="Chapter&nbsp;19.&nbsp;Introduction"><link rel="next" href="re-relationships-loading-control.html" title="Chapter&nbsp;21.&nbsp;Other Settings"><script xmlns:d="http://docbook.org/ns/docbook" type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-7036673-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div xmlns:d="http://docbook.org/ns/docbook" class="navheader"><table width="100%" summary="Navigation header"><tr><th class="versioninfo">v.4.0 (4.0.M5)</th><th align="center">Chapter&nbsp;20.&nbsp;Filtering</th><th></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="re-introduction.html">Prev</a>&nbsp;</td><th width="60%" align="center"><a accesskey="u" href="cayenne-guide-part4.html">Part&nbsp;IV.&nbsp;DB-First Flow</a></th><td width="20%" align="right">&nbsp;<a accesskey="n" href="re-relationships-loading-control.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="re-filtering"></a>Chapter&nbsp;20.&nbsp;Filtering</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="re-filtering.html#everything-schema-catalog">Process everything from schema/catalog</a></span></dt><dt><span class="section"><a href="re-filtering.html#combine-schema-catalog">Combine Schema and Catalog filters</a></span></dt><dt><span class="section"><a href="re-filtering.html#including-excluding-tables-columns-procedures">Including and Excluding tables, columns and procedures</a></span></dt><dt><span class="section"><a href="re-filtering.html#complete-filtering-example">Complete filtering example</a></span></dt><dt><span class="section"><a href="re-filtering.html#d0e3501">Ant configuration example</a></span></dt></dl></div><p>
The first thing you usually want to control during reverse engineering is what exactly should be loaded from database and
what not. One of the most common cases is excluding system tables, as you usually don't want to map them.
</p><p>
Briefly, you are able to include/exclude tables, columns and procedures and do it at several levels: default, catalog, schema.
Although everything defined at the top level (default rules) will be applied for the nested elements, all rules from the most specific
areas will override general rules (i.e. rules from schemas override rules from catalogs and even more override default rules).
</p><p>
The following use-cases will provide you a better understanding of how filtering works and how you could use it.
</p><div class="section"><div class="titlepage"><div><div><h2 class="title"><a name="everything-schema-catalog"></a>Process everything from schema/catalog</h2></div></div></div><p>
The simplest example of reverse engineering is processing tables from one schema of catalog and there are several options to do this.
Basic syntax is described below:
</p><pre class="programlisting"><span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;dbimport&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-comment">&lt;!-- Ant/Maven in case you only want to specify the schema to import --&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;schema&gt;</span>SCHEMA_NAME<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/schema&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-comment">&lt;!-- Maven way in case you have nested elements in the schema --&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;schema&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;name&gt;</span>SCHEMA_NAME<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/name&gt;</span>
...
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/schema&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-comment">&lt;!-- Ant way in case you have nested elements in the schema --&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;schema</span> <span xmlns="http://www.w3.org/1999/xhtml" class="hl-attribute">name</span>=<span xmlns="http://www.w3.org/1999/xhtml" class="hl-value">"SCHEMA_NAME"</span><span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&gt;</span>
...
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/schema&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/dbimport&gt;</span> </pre><p>
The same options are available for catalogs:
</p><pre class="programlisting"> <span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;dbimport&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-comment">&lt;!-- Ant/Maven in case you only want to specify the catalog to import --&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;catalog&gt;</span>CATALOG_NAME<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-comment">&lt;!-- Maven way in case you have nested elements in the catalog --&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;name&gt;</span>CATALOG_NAME<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/name&gt;</span>
...
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-comment">&lt;!-- Ant way in case you have nested elements in the catalog --&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;catalog</span> <span xmlns="http://www.w3.org/1999/xhtml" class="hl-attribute">name</span>=<span xmlns="http://www.w3.org/1999/xhtml" class="hl-value">"CATALOG_NAME"</span><span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&gt;</span>
...
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/dbimport&gt;</span></pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Current version of reverse engineering doesn't support catalog filtering for Postgres database.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title"><a name="combine-schema-catalog"></a>Combine Schema and Catalog filters</h2></div></div></div><p>
Cayenne supports combination of different schemas and catalogs, and it filters data according to your requirements.
You could achieve this by the following example of reverse engineering configuration:
</p><pre class="programlisting"><span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;dbimport&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;name&gt;</span>shop_01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/name&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;schema&gt;</span>schema-name-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/schema&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;schema&gt;</span>schema-name-02<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/schema&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;schema&gt;</span>schema-name-03<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/schema&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;name&gt;</span>shop_02<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/name&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;schema&gt;</span>schema-name-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/schema&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;name&gt;</span>shop_03<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/name&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;schema&gt;</span>schema-name-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/schema&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;schema&gt;</span>schema-name-02<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/schema&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;schema&gt;</span>schema-name-03<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/schema&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/dbimport&gt;</span></pre><p>
In the example above, Cayenne reverse engineering process contains three catalogs named as shop_01, shop_02 and shop_03,
each of wich has their own schemas. Cayenne will load all data only from the declared catalogs and schemas.
</p><p>
If you want to load everything from database, you could simply declare catalog specification alone.
</p><pre class="programlisting"><span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;dbimport&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;catalog&gt;</span>shop_01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;catalog&gt;</span>shop_02<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;catalog&gt;</span>shop_03<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/dbimport&gt;</span></pre><p>
If you want to do reverse engineering for specific schemas, just remove unwanted schemas from the catalog section.
For example, if you want to process schema-name-01 and schema-name-03 schemas only, then you should change reverse engineering section like this.
</p><pre class="programlisting"><span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;dbimport&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;name&gt;</span>shop_01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/name&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;schema&gt;</span>schema-name-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/schema&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;schema&gt;</span>schema-name-03<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/schema&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;name&gt;</span>shop_02<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/name&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;schema&gt;</span>schema-name-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/schema&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;name&gt;</span>shop_03<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/name&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;schema&gt;</span>schema-name-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/schema&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;schema&gt;</span>schema-name-03<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/schema&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/dbimport&gt;</span></pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title"><a name="including-excluding-tables-columns-procedures"></a>Including and Excluding tables, columns and procedures</h2></div></div></div><p>
Cayenne reverse engineering let you fine tune table, columns and stored procedures names that you need to import
to your model file. In every filter you can use regexp syntax. Here is some examples of configuration
for common tasks.
</p><p>
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>Include tables with &#8216;CRM_&#8217; prefix if you are working in that domain of application:</p><pre class="programlisting"><span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeTable&gt;</span>CRM_.*<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/includeTable&gt;</span></pre></li><li class="listitem"><p>Include tables with &#8216;_LOOKUP&#8217; suffix</p><pre class="programlisting"><span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeTable&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;pattern&gt;</span>.*_LOOKUP<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/pattern&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/includeTable&gt;</span></pre></li><li class="listitem"><p>Exclude tables with &#8216;CRM_&#8217; prefix if you are not working only in that domain of application:</p><pre class="programlisting"><span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;excludeTable&gt;</span>CRM_.*<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/excludeTable&gt;</span></pre></li><li class="listitem"><p>Include only specific columns that follows specific naming convention:</p><pre class="programlisting"><span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeColumn&gt;</span>includeColumn01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/includeColumn&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeColumn&gt;</span>includeColumn03<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/includeColumn&gt;</span></pre></li><li class="listitem"><p>Exclude system or obsolete columns:</p><pre class="programlisting"><span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;excludeColumn&gt;</span>excludeColumn01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/excludeColumn&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;excludeColumn&gt;</span>excludeColumn03<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/excludeColumn&gt;</span></pre></li><li class="listitem"><p>Include/Exclude columns for particular table or group of tables:</p><pre class="programlisting"><span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeTable&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;pattern&gt;</span>table pattern<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/pattern&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeColumn&gt;</span>includeColumn01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/includeColumn&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;excludeColumn&gt;</span>excludeColumn01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/excludeColumn&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/includeTable&gt;</span></pre></li><li class="listitem"><p>Include stored procedures:</p><pre class="programlisting"><span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeProcedure&gt;</span>includeProcedure01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/includeProcedure&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeProcedure&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;pattern&gt;</span>includeProcedure03<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/pattern&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/includeProcedure&gt;</span></pre></li><li class="listitem"><p>Exclude stored procedures by pattern:</p><pre class="programlisting"><span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;excludeProcedure&gt;</span>excludeProcedure01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/excludeProcedure&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;excludeProcedure&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;pattern&gt;</span>excludeProcedure03<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/pattern&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/excludeProcedure&gt;</span></pre></li></ol></div><p>
</p><p> All filtering tags <code class="code">&lt;includeTable&gt;</code>,
<code class="code">&lt;excludeTable&gt;</code>, <code class="code">&lt;includeColumn&gt;</code>,
<code class="code">&lt;excludeColumn&gt;</code>, <code class="code">&lt;includeProcedure&gt;</code> and
<code class="code">&lt;excludeProcedure&gt;</code> have 2 ways to pass filtering RegExp.
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>text inside tag</p><pre class="programlisting">
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeTable&gt;</span>CRM_.*<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/includeTable&gt;</span></pre></li><li class="listitem"><p>pattern inner tag</p><pre class="programlisting">
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeTable&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;pattern&gt;</span>.*_LOOKUP<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/pattern&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/includeTable&gt;</span></pre></li></ol></div><p>
</p><p>
All filtering tags can be placed inside schema and catalog tags, but also inside <code class="code">&lt;dbimport&gt;</code> tag. It means that filtering rules
will be applied for all schemas and catalogs.
</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title"><a name="complete-filtering-example"></a>Complete filtering example</h2></div></div></div><p>
Initially, let&#8217;s make a small sample. Consider the following reverse engineering configuration.
</p><pre class="programlisting"><span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;dbimport&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;catalog&gt;</span>shop-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/dbimport&gt;</span> </pre><p>
In this case reverse engineering will not filter anything from the shop-01 catalog. If you really want to filter database columns, tables,
stored procedures and relationships, you could do it in the following way.
</p><pre class="programlisting"><span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;dbimport&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;catalog&gt;</span>shop-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;name&gt;</span>shop-02<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/name&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeTable&gt;</span>includeTable-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/includeTable&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/dbimport&gt;</span></pre><p>
Then Cayenne will do reverse engineering for both shop-01 and shop-02 catalogs. First catalog will not be processed for filtering,
but the second catalog will be processed with &#8220;includeTable-01&#8221; filter.
</p><p>
Let&#8217;s assume you have a lot of table prefixes with the same names. Cayenne allows you to mention a pattern as regular expression.
Using regular expressions is easier way to handle a big amount of database entities than writing filter config for each use-case.
They make your configuration more readable, understandable and straightforward. There is not complex.
Let&#8217;s see how to use patterns in reverse engineering configuration with complete example.
</p><pre class="programlisting"><span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;dbimport&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;catalog&gt;</span>shop-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;name&gt;</span>shop-02<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/name&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;name&gt;</span>shop-03<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/name&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeTable&gt;</span>includeTable-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/includeTable&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeTable&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;pattern&gt;</span>includeTable-02<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/pattern&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/includeTable&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeTable&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;pattern&gt;</span>includeTable-03<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/pattern&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeColumn&gt;</span>includeColumn-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/includeColumn&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;excludeColumn&gt;</span>excludeColumn-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/excludeColumn&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/includeTable&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;excludeTable&gt;</span>excludeTable-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/excludeTable&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;excludeTable&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;pattern&gt;</span>excludeTable-02<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/pattern&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/excludeTable&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeColumn&gt;</span>includeColumn-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/includeColumn&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeColumn&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;pattern&gt;</span>includeColumn-02<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/pattern&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/includeColumn&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;excludeColumn&gt;</span>excludeColumn-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/excludeColumn&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;excludeColumn&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;pattern&gt;</span>excludeColumn-02<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/pattern&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/excludeColumn&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeProcedure&gt;</span>includeProcedure-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/includeProcedure&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeProcedure&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;pattern&gt;</span>includeProcedure-02<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/pattern&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/includeProcedure&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;excludeProcedure&gt;</span>excludeProcedure-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/excludeProcedure&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;excludeProcedure&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;pattern&gt;</span>excludeProcedure-02<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/pattern&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/excludeProcedure&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/dbimport&gt;</span></pre><p>The example above should provide you more idea about how to use filtering and patterns
in Cayenne reverse engineering. You could notice that this example demonstrates you the
"name" and "pattern" configurations. Yes, you could use these as separates xml element
and xml attributes. </p><p>
The cdbimport will execute reverse engineering task for all entities from &#8220;shop-01&#8221; and &#8220;shop-02&#8221;, including tables, views, stored procedures
and table columns. As &#8220;shop-03&#8221; has variety filter tags, entities from this catalog will be filtered by cdbimport.
</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title"><a name="d0e3501"></a>Ant configuration example</h2></div></div></div><p> Here is config sample for <code class="code">Ant</code> task:
</p><pre class="programlisting"><span xmlns="http://www.w3.org/1999/xhtml" class="hl-comment">&lt;!-- inside &lt;cdbimport&gt; tag --&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;catalog&gt;</span>shop-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/catalog&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;catalog</span> <span xmlns="http://www.w3.org/1999/xhtml" class="hl-attribute">name</span>=<span xmlns="http://www.w3.org/1999/xhtml" class="hl-value">"shop-02"</span><span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">/&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;catalog</span> <span xmlns="http://www.w3.org/1999/xhtml" class="hl-attribute">name</span>=<span xmlns="http://www.w3.org/1999/xhtml" class="hl-value">"shop-03"</span><span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeTable&gt;</span>includeTable-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/includeTable&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeTable</span> <span xmlns="http://www.w3.org/1999/xhtml" class="hl-attribute">pattern</span>=<span xmlns="http://www.w3.org/1999/xhtml" class="hl-value">"includeTable-02"</span><span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">/&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeTable</span> <span xmlns="http://www.w3.org/1999/xhtml" class="hl-attribute">pattern</span>=<span xmlns="http://www.w3.org/1999/xhtml" class="hl-value">"includeTable-03"</span><span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeColumn&gt;</span>includeColumn-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/includeColumn&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;excludeColumn&gt;</span>excludeColumn-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/excludeColumn&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/includeTable&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;excludeTable&gt;</span>excludeTable-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/excludeTable&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;excludeTable</span> <span xmlns="http://www.w3.org/1999/xhtml" class="hl-attribute">pattern</span>=<span xmlns="http://www.w3.org/1999/xhtml" class="hl-value">"excludeTable-02"</span><span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">/&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeColumn&gt;</span>includeColumn-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/includeColumn&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeColumn</span> <span xmlns="http://www.w3.org/1999/xhtml" class="hl-attribute">pattern</span>=<span xmlns="http://www.w3.org/1999/xhtml" class="hl-value">"includeColumn-02"</span><span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">/&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;excludeColumn&gt;</span>excludeColumn-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/excludeColumn&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;excludeColumn</span> <span xmlns="http://www.w3.org/1999/xhtml" class="hl-attribute">pattern</span>=<span xmlns="http://www.w3.org/1999/xhtml" class="hl-value">"excludeColumn-02"</span><span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">/&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeProcedure&gt;</span>includeProcedure-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/includeProcedure&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;includeProcedure</span> <span xmlns="http://www.w3.org/1999/xhtml" class="hl-attribute">pattern</span>=<span xmlns="http://www.w3.org/1999/xhtml" class="hl-value">"includeProcedure-02"</span><span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">/&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;excludeProcedure&gt;</span>excludeProcedure-01<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/excludeProcedure&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;excludeProcedure</span> <span xmlns="http://www.w3.org/1999/xhtml" class="hl-attribute">pattern</span>=<span xmlns="http://www.w3.org/1999/xhtml" class="hl-value">"excludeProcedure-02"</span><span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">/&gt;</span>
<span xmlns="http://www.w3.org/1999/xhtml" class="hl-tag">&lt;/catalog&gt;</span></pre><p>
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
In Ant task configuration all filter tags located inside root tag <code class="code">&lt;cdbimport&gt;</code> as there is no <code class="code">&lt;dbimport&gt;</code> tag.
</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="re-introduction.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="cayenne-guide-part4.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="re-relationships-loading-control.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter&nbsp;19.&nbsp;Introduction&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Chapter&nbsp;21.&nbsp;Other Settings</td></tr></table></div></body></html>