Author: irooskov(a)redhat.com
Date: 2011-07-17 21:59:12 -0400 (Sun, 17 Jul 2011)
New Revision: 32975
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Book_Info.xml
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Feedback.xml
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Hibernate_Tools_Reference_Guide.ent
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Hibernate_Tools_Reference_Guide.xml
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Preface.xml
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Revision_History.xml
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/ant.xml
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/codegen.xml
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/codegenarchitecture.xml
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/add_property1.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/add_property2.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/add_property3.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/add_property4.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/add_property5.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/annotations1.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/annotations1_a.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/annotations2.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/annotations3.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/dali_integration1.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/dali_integration10.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/dali_integration11.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/dali_integration2.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/dali_integration3.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/dali_integration4.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/dali_integration5.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/dali_integration7.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/dali_integration9.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/diagram1.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/diagram2.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/diagramToolbar.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/map_diagram1.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/map_diagram2.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/map_diagram3.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_0.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_0_a.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_0_b.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_1.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_12.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_12_a.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_12_b.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_13.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_14.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_15.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_16.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_17.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_17_a.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_18.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_18_a.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_18_b.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_18_g.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_19.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_19_b.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_19_c.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_19_d.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_2.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_20.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_21_a.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_21_b.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_22.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_2_a.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_3.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_4_a.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_4_b.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_4_c.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_4_d.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_5.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_6.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_7.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_8.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_8a.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_8b.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_9.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/prototypingQueries.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/saveDiagram.png
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/introduction.xml
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/master.xml
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/plugins.xml
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/reverseengineering.xml
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/setup.xml
branches/jbosstools-3.2.x/hibernatetools/docs/reference/pom.xml
Log:
updated for GA
Modified: branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Book_Info.xml
===================================================================
--- branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Book_Info.xml 2011-07-18
01:51:18 UTC (rev 32974)
+++ branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Book_Info.xml 2011-07-18
01:59:12 UTC (rev 32975)
@@ -5,11 +5,13 @@
<title>Hibernate Tools Reference Guide</title>
<subtitle>Provides information relating to the Hibernate Tools
set.</subtitle>
<productname>JBoss Developer Studio</productname>
- <productnumber>4.0</productnumber>
- <edition>4.0.0</edition>
- <pubsnumber>4</pubsnumber>
+ <productnumber>4.1</productnumber>
+ <edition>4.1.0</edition>
+ <pubsnumber>1</pubsnumber>
<abstract>
- <para>The Hibernate Tools Reference Guide explains how to use the Hibernate Tools
to perform reverse engineering, code generation, visualization and interaction with
Hibernate.</para>
+ <para>
+ The Hibernate Tools Reference Guide explains how to use the Hibernate Tools to perform
reverse engineering, code generation, visualization and interaction with Hibernate.
+ </para>
</abstract>
<corpauthor>
<inlinemediaobject>
Modified: branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Feedback.xml
===================================================================
--- branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Feedback.xml 2011-07-18
01:51:18 UTC (rev 32974)
+++ branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Feedback.xml 2011-07-18
01:59:12 UTC (rev 32975)
@@ -1,20 +1,92 @@
<?xml version='1.0' encoding='utf-8' ?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "../Document_Conventions.ent">
+%BOOK_ENTITIES;
+]>
+<appendix id="sect_JBoss-Getting_Help_and_Giving_Feedback"
lang="en-US">
+ <title>Getting Help and Giving Feedback</title>
+ <section id="sect_JBoss-Do_You_Need_Help">
+ <title>Do You Need Help?</title>
+ <indexterm>
+ <primary>help</primary>
+ <secondary>getting help</secondary>
-<section id="sect-Beginners_Guide-We_Need_Feedback"
lang="en-US">
- <title>We Need Feedback!</title>
- <indexterm>
- <primary>feedback</primary>
- <secondary>contact information for this manual</secondary>
- </indexterm>
- <para>
- If you find a typographical error in this manual, or if you have thought of a way to
make this manual better, we would love to hear from you! Please submit a report in JIRA
against JBoss Developer Studio: <ulink
url="https://jira.jboss.org/jira/secure/CreateIssue.jspa?pid=1231050...
- </para>
- <para>
- When submitting a bug report, be sure to mention the manual's name and to select
the "documentation" component.
- </para>
- <para>
- If you have a suggestion for improving the documentation, try to be as specific as
possible when describing it. If you have found an error, please include the section number
and some of the surrounding text so we can find it easily.
- </para>
-</section>
+ </indexterm>
+ <para>
+ If you experience difficulty with a procedure described in this documentation, visit
the Red Hat Customer Portal at <ulink url="http://access.redhat.com" />.
Through the customer portal, you can:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ search or browse through a knowledgebase of technical support articles about Red Hat
products.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ submit a support case to Red Hat Global Support Services (GSS).
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ access other product documentation.
+ </para>
+
+ </listitem>
+
+ </itemizedlist>
+ <para>
+ Red Hat also hosts a large number of electronic mailing lists for discussion of Red
Hat software and technology. You can find a list of publicly available mailing lists at
<ulink
url="https://www.redhat.com/mailman/listinfo" />. Click on the name
of any mailing list to subscribe to that list or to access the list archives.
+ </para>
+
+ </section>
+
+ <section id="jboss-feedback">
+ <title>Give us Feedback</title>
+ <!-- NOTE: You will need the following entities defined in your .ent file.
+ You will need to replace _YOUR_PRODUCT_HERE_, _YOUR_COMPONENT_
+ and _YOUR_SUMMARY_ - entities are not replaced in URLs.
+ <!ENTITY PRODUCT "JBoss Product Name">
+ <!ENTITY BZCOMPONENT "doc-triage">
+ <!ENTITY BZURL "<ulink
url='https://bugzilla.example.com/enter_bug.cgi?product=_YOUR_PRODUCT...
+
+ These entities should not affect translated documents, since Bugzilla is not
localised.
+ --> <indexterm>
+ <primary>feedback</primary>
+ <secondary>contact information for this manual</secondary>
+
+ </indexterm>
+ <para>
+ If you find a typographical error, or know how this guide can be improved, we would
love to hear from you. Submit a report in Bugzilla against the product
<literal>&BZPRODUCT;</literal> and the component
<literal>&BZCOMPONENT;</literal>. The following link will take you to a
pre-filled bug report for this product: &BZURL;.
+ </para>
+ <para>
+ Fill out the following template in Bugzilla's
<literal>Description</literal> field. Be as specific as possible when
describing the issue; this will help ensure that we can fix it quickly.
+ </para>
+
+<screen>Document URL:
+
+
+Section Number and Name:
+
+
+Describe the issue:
+
+
+Suggestions for improvement:
+
+
+Additional information:
+
+
+</screen>
+ <para>
+ Be sure to give us your name so that you can receive full credit for reporting the
issue.
+ </para>
+
+ </section>
+
+
+</appendix>
+
+
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Hibernate_Tools_Reference_Guide.ent
===================================================================
---
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Hibernate_Tools_Reference_Guide.ent 2011-07-18
01:51:18 UTC (rev 32974)
+++
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Hibernate_Tools_Reference_Guide.ent 2011-07-18
01:59:12 UTC (rev 32975)
@@ -1,4 +1,7 @@
<!ENTITY PRODUCT "JBoss">
<!ENTITY BOOKID "Hibernate_Tools_Reference_Guide">
-<!ENTITY YEAR "2010">
+<!ENTITY YEAR "2011">
<!ENTITY HOLDER "Red Hat">
+<!ENTITY BZPRODUCT "JBoss Developer Studio">
+<!ENTITY BZCOMPONENT "Hibernate Tools Reference Guide">
+<!ENTITY BZURL "<ulink
url='https://bugzilla.redhat.com/enter_bug.cgi?product=JBoss&perc...
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Hibernate_Tools_Reference_Guide.xml
===================================================================
---
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Hibernate_Tools_Reference_Guide.xml 2011-07-18
01:51:18 UTC (rev 32974)
+++
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Hibernate_Tools_Reference_Guide.xml 2011-07-18
01:59:12 UTC (rev 32975)
@@ -5,11 +5,12 @@
<xi:include href="Book_Info.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
<xi:include href="Preface.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
<xi:include href="introduction.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
-<xi:include href="setup.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
+<!--xi:include href="setup.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include--...
<xi:include href="codegenarchitecture.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
<xi:include href="plugins.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
<xi:include href="ant.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
<xi:include href="reverseengineering.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
<xi:include href="codegen.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
+<xi:include href="Feedback.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="Revision_History.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
</book>
Modified: branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Preface.xml
===================================================================
--- branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Preface.xml 2011-07-18
01:51:18 UTC (rev 32974)
+++ branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Preface.xml 2011-07-18
01:59:12 UTC (rev 32975)
@@ -8,9 +8,5 @@
<para>
This manual uses several conventions to highlight certain words and phrases and draw
attention to specific pieces of information. To get more information on these conventions
please refer to the <guilabel>Document Conventions</guilabel> manual, which
can be found on the <ulink
url="http://docs.redhat.com/docs/en-US/JBoss_Developer_Studio/index....
Hat Documentation</ulink> website under the <guilabel>JBoss Developer
Studio</guilabel> section.
</para>
- <!--<xi:include href="Common_Content/Conventions.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="Feedback.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"><xi:fallback
xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include
href="Common_Content/Feedback.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
- </xi:fallback>
- </xi:include>-->
</preface>
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Revision_History.xml
===================================================================
---
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Revision_History.xml 2011-07-18
01:51:18 UTC (rev 32974)
+++
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Revision_History.xml 2011-07-18
01:59:12 UTC (rev 32975)
@@ -2,31 +2,51 @@
<!DOCTYPE Book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
]>
<appendix>
- <title>Revision History</title>
- <simpara>
- <revhistory>
- <revision>
- <revnumber>1</revnumber><date>Wed Jun 09
2010</date>
- <author>
- <firstname>JBoss
Tools</firstname><surname>Documentation
Team</surname><email>irooskov(a)redhat.com</email>
- </author>
- <revdescription>
- <simplelist>
- <member>General updates</member>
- </simplelist>
- </revdescription>
- </revision>
- <revision>
- <revnumber>0</revnumber><date>Fri Nov 20
2009</date>
- <author>
-
<firstname>Isaac</firstname><surname>Rooskov</surname><email>irooskov(a)redhat.com</email>
- </author>
- <revdescription>
- <simplelist>
- <member>Initial creation of book by
publican</member>
- </simplelist>
- </revdescription>
- </revision>
- </revhistory>
- </simpara>
+ <title>Revision History</title>
+ <simpara>
+ <revhistory>
+ <revision>
+ <revnumber>2-0</revnumber>
+ <date>Fri Jan 21 2011</date>
+ <author>
+ <firstname>JBoss Tools</firstname>
+ <surname>Documentation Team</surname>
+ <email>mcaspers(a)redhat.com</email>
+ </author>
+ <revdescription>
+ <simplelist>
+ <member>General updates</member>
+ </simplelist>
+ </revdescription>
+ </revision>
+ <revision>
+ <revnumber>1-0</revnumber>
+ <date>Wed Jun 09 2010</date>
+ <author>
+ <firstname>JBoss Tools</firstname>
+ <surname>Documentation Team</surname>
+ <email>irooskov(a)redhat.com</email>
+ </author>
+ <revdescription>
+ <simplelist>
+ <member>General updates</member>
+ </simplelist>
+ </revdescription>
+ </revision>
+ <revision>
+ <revnumber>0-0</revnumber>
+ <date>Fri Nov 20 2009</date>
+ <author>
+ <firstname>Isaac</firstname>
+ <surname>Rooskov</surname>
+ <email>irooskov(a)redhat.com</email>
+ </author>
+ <revdescription>
+ <simplelist>
+ <member>Initial creation of book by publican</member>
+ </simplelist>
+ </revdescription>
+ </revision>
+ </revhistory>
+ </simpara>
</appendix>
Modified: branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/ant.xml
===================================================================
--- branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/ant.xml 2011-07-18
01:51:18 UTC (rev 32974)
+++ branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/ant.xml 2011-07-18
01:59:12 UTC (rev 32975)
@@ -2,42 +2,30 @@
<chapter id="ant">
<title>Ant Tools</title>
- <para>Maybe somebody will find it more preferable to use Ant for generation
purposes. Thus, this
- chapter is intended to get you ready to start using Hibernate Tools via Ant
tasks.</para>
+ <para>This chapter demonstrates how to use Hibernate Tools via Ant
tasks.</para>
<section>
<title>Introduction</title>
- <para>The <emphasis>
- <property>hibernate-tools.jar</property>
- </emphasis> contains the core for the <property>Hibernate
Tools</property>. It is used as the
- basis for both the Ant tasks described in this document and the eclipse plugins
both available
- from
tools.hibernate.org. The <emphasis>
- <property>hibernate-tools.jar</property>
- </emphasis> is located in your eclipse plugins directory at <emphasis>
-
<property>/plugins/org.hibernate.eclipse.x.x.x/lib/tools/hibernate-tools.jar</property>.</emphasis></para>
- <para>This jar is 100% independent from the eclipse platform and can thus be
used independently
- of eclipse.</para>
+ <para>
+ The <filename>hibernate-tools.jar</filename> file, available from
<ulink
url="http://www.hibernate.org/subprojects/tools.html">tools....;,
contains the core code for <productname>Hibernate Tools</productname>. It is
used as the basis for both the Ant tasks described in this document and the Eclipse
plugins available as part of JBoss Developer Studio. The
<filename>hibernate-tools.jar</filename> file is located in your Eclipse
plugins directory at
<filename>/plugins/org.hibernate.eclipse.x.x.x/lib/tools/hibernate-tools.jar</filename>.
+ </para>
+ <para>This jar is 100% independent from the Eclipse platform and can thus be
used independently of Eclipse.</para>
<note>
<title>Note:</title>
- <para>There might be incompatibilities with respect to the Hibernate3.jar
bundled with the
- tools and your own jar. Thus to avoid any confusion it is recommended to use the
- hibernate3.jar and hibernate-annotations.jar bundled with the tools when you want
to use the
- Ant tasks. Do not worry about using e.g. Hibernate 3.2 jar's with e.g. a
Hibernate 3.1
- project since the output generated will work with previous Hibernate 3 versions.
</para>
+ <para>
+ There may be incompatibilities with respect to the
<filename>hibernate3.jar</filename> bundled with the tools and your own JAR.
To avoid any confusion it is recommended that you use the
<filename>hibernate3.jar</filename> and
<filename>hibernate-annotations.jar</filename> files bundled with the tools
when you want to use the Ant tasks. Do not worry about using the JAR's from a later
version of Hibernate (e.g. Hibernate 3.2) with a project using an earlier version of
Hibernate (e.g. a Hibernate 3.1) since the generated output will work with previous
Hibernate 3 versions.
+ </para>
</note>
</section>
<section>
<title>The <hibernatetool> Ant Task</title>
- <para>To use the ant tasks you need to have the <emphasis>
- <property>hibernatetool</property>
- </emphasis> task defined. That is done in your <emphasis>
- <property>build.xml</property>
- </emphasis> by inserting the following xml (assuming the jars are in the
- <literal>lib</literal> directory): </para>
+ <para>
+ To use the Ant tasks you need to have the <code>hibernatetool</code>
task defined. That is done in your <filename>build.xml</filename> file by
inserting the following XML (assuming the JARs are located in the
<filename>lib</filename> directory):
+ </para>
<programlisting role="XML"><![CDATA[<path
id="toolslib">
<path location="lib/hibernate-tools.jar" />
@@ -51,23 +39,17 @@
classpathref="toolslib" />
]]></programlisting>
- <para>This
- <code><taskdef></code>
- defines an Ant task called <emphasis>
- <property> hibernatetool </property>
- </emphasis> which now can be used anywhere in your ant <emphasis>
- <property>build.xml</property>
- </emphasis> files. It is important to include all the
<property>Hibernate Tools</property>
- dependencies as well as the jdbc driver.</para>
+ <para>
+ This <code><taskdef></code> defines an Ant task called
<code> hibernatetool </code> which now can be used anywhere in your Ant
<filename>build.xml</filename> files. It is important to include all the
<productname>Hibernate Tools</productname> dependencies as well as the JDBC
driver.
+ </para>
- <para>Notice that to use the annotation based Configuration you must <ulink
- url="http://annotations.hibernate.org">get a release</ulink>.
</para>
+ <para>
+ Notice that to use the annotation based Configuration you must <ulink
url="http://www.hibernate.org/">get a release</ulink>.
+ </para>
<para/>
- <para>When using the <emphasis>
- <property> hibernatetool </property>
- </emphasis> task you have to specify one or more of the
following:</para>
+ <para>When using the <code>hibernatetool</code> task you have to
specify one or more of the following:</para>
<programlisting role="XML"><![CDATA[<hibernatetool
destdir="defaultDestinationDirectory"
@@ -110,7 +92,7 @@
</entry>
<entry>
- <para>Destination directory for files generated with
exporters</para>
+ <para>Destination directory for files generated with the
exporters</para>
</entry>
<entry>
@@ -124,7 +106,7 @@
</entry>
<entry>
- <para>A path to be used to look up user-edited
templates</para>
+ <para>A path used for looking up user-edited templates</para>
</entry>
<entry>
@@ -138,8 +120,7 @@
</entry>
<entry>
- <para>A classpath to be used to resolve resources, such as mappings
and
- usertypes</para>
+ <para>A classpath to be used to resolve resources, such as mappings
and user types</para>
</entry>
<entry>
@@ -154,8 +135,7 @@
</entry>
<entry>
- <para>Used to set properties to control the exporters. Mostly
relevant for providing
- custom properties to user defined templates</para>
+ <para>Used to set properties that control the exporters. Mostly
relevant for providing custom properties to user defined templates</para>
</entry>
<entry>
@@ -165,13 +145,11 @@
<row>
<entry>
- <para>configuration (annotationconfiguration, jpaconfiguration,
- jdbcconfiguration)</para>
+ <para>configuration (annotationconfiguration, jpaconfiguration,
jdbcconfiguration)</para>
</entry>
<entry>
- <para>One of four different ways of configuring the Hibernate Meta
Model must be
- specified</para>
+ <para>One of four different ways of configuring the Hibernate Meta
Model must be specified</para>
</entry>
<entry>
@@ -201,12 +179,9 @@
<section>
<title>Basic examples</title>
- <para>The following example shows the most basic setup for generating
pojo's via <code><hbm2java></code> from a normal
<emphasis>
- <property>
- <literal>hibernate.cfg.xml</literal>
- </property>. </emphasis> The output will be put in the
<emphasis>
- <property>${build.dir}/generated</property>
- </emphasis> directory.</para>
+ <para>
+ The following example shows the most basic setup for generating POJOs via
<code><hbm2java></code> from a normal
<filename>hibernate.cfg.xml</filename> file. The output will be placed in the
<filename>${build.dir}/generated</filename> directory.
+ </para>
<programlisting role="XML"><![CDATA[<hibernatetool
destdir="${build.dir}/generated">
<classpath>
@@ -218,17 +193,13 @@
</hibernatetool>]]></programlisting>
- <para>The following example is similar, but now we are performing multiple
exports from the
- same configuration. We are exporting the schema via
<code><hbm2dll></code>, generates some DAO code via
<code><hbm2dao></code>
- and finally runs a custom code generation via
<code><hbmtemplate></code>. This is again from a normal
<emphasis>
- <property>hibernate.cfg.xml</property>
- </emphasis> and the output is still put in the <emphasis>
- <property>
- <literal>${build.dir}/generated</literal>
- </property>
- </emphasis> directory. Furthermore the example also shows where a classpath
is specified
- when you e.g. have custom usertypes or some mappings that is needed to be looked
up as a
- classpath resource.</para>
+ <para>
+ The following example is similar, but now we are performing multiple exports from
the same configuration. We are exporting the schema via
<code><hbm2dll></code>, generating some DAO code via
<code><hbm2dao></code>, and finally running some custom code
generation via <code><hbmtemplate></code>. This is again from a
normal <filename>hibernate.cfg.xml</filename> file, and the output is still
placed in the <filename>${build.dir}/generated</filename> directory.
+ </para>
+
+ <para>
+ The example also shows how a classpath is specified, which is useful when you
have custom user types or some mappings that are required to be looked up as a classpath
resource.
+ </para>
<programlisting role="XML"><![CDATA[<hibernatetool
destdir="${build.dir}/generated">
<classpath>
@@ -251,36 +222,29 @@
<section>
<title>Hibernate Configurations</title>
- <para><emphasis>Hibernatetool</emphasis> supports four different
Hibernate configurations: A
- standard Hibernate configuration
- (<code><configuration></code>), Annotation based
- configuration (<code><annotationconfiguration></code>),
- JPA persistence based configuration
- (<code><jpaconfiguration></code>) and a JDBC based
- configuration (<code><jdbcconfiguration></code>)
- for use when reverse engineering.</para>
+ <para>
+ <productname>Hibernatetool</productname> supports four different
Hibernate configurations: A standard Hibernate configuration
(<code><configuration></code>), Annotation based configuration
(<code><annotationconfiguration></code>), JPA persistence based
configuration (<code><jpaconfiguration></code>) and a JDBC
based configuration (<code><jdbcconfiguration></code>) used
when reverse engineering.
+ </para>
- <para>Each have in common that they are able to build up a Hibernate
Configuration object from
- which a set of exporters can be run to generate various output. </para>
+ <para>
+ Each can be used to build a Hibernate Configuration object, from which a set of
exporters can be run in order to generate various output formats.
+ </para>
<note>
<title>Note:</title>
- <para>Output can be anything, e.g. specific files, statements execution
against a database,
- error reporting or anything else that can be done in java code.</para>
+ <para>
+ Output can be anything, e.g. specific files, statements execution against a
database, error reporting or anything else that can be done in Java code.
+ </para>
</note>
- <para>The following sections describe what the various configurations can do,
plus lists the
- individual settings they have.</para>
+ <para>The following sections describe what the various configurations can do,
as well as listing their individual settings.</para>
<section>
<title>Standard Hibernate Configuration
(<configuration>)</title>
- <para>A
- <code><configuration></code>
- is used to define a standard Hibernate configuration. A standard Hibernate
- configuration reads the mappings from a <emphasis>
- <property>cfg.xml</property>
- </emphasis> and/or a fileset.</para>
+ <para>
+ A <code><configuration></code> tag is used to define a
standard Hibernate configuration. A standard Hibernate configuration reads the mappings
from a <filename>cfg.xml</filename> file and/or a fileset.
+ </para>
<programlisting role="XML"><![CDATA[<configuration
configurationfile="hibernate.cfg.xml"
@@ -321,7 +285,7 @@
</entry>
<entry>
- <para>The name of a Hibernate configuration file, e.g.
"hibernate.cfg.xml"</para>
+ <para>The name of a Hibernate configuration file, e.g.
<filename>hibernate.cfg.xml</filename>.</para>
</entry>
<entry>
@@ -335,7 +299,7 @@
</entry>
<entry>
- <para>The name of a property file, e.g.
"hibernate.properties"</para>
+ <para>The name of a property file, e.g.
<filename>hibernate.properties</filename>.</para>
</entry>
<entry>
@@ -349,8 +313,7 @@
</entry>
<entry>
- <para>Name of a class that implements org.xml.sax.EntityResolver.
Used if the
- mapping files require custom entity resolver</para>
+ <para>Name of a class that implements
<code>org.xml.sax.EntityResolver</code>. Used if the mapping files require
custom entity resolver.</para>
</entry>
<entry>
@@ -365,9 +328,9 @@
</entry>
<entry>
- <para>Name of a class that implements
org.hibernate.cfg.NamingStrategy. Used for
- setting up the naming strategy in Hibernate which controls the
automatic naming of
- tables and columns.In JPA projects naming strategy is supported for
default Name/Columns mapping</para>
+ <para>
+ Name of a class that implements
<code>org.hibernate.cfg.NamingStrategy</code>. Used for setting up the naming
strategy in Hibernate which controls the automatic naming of tables and columns. In JPA
projects naming strategy is supported for default Name/Columns mapping.
+ </para>
</entry>
<entry>
@@ -381,9 +344,9 @@
</entry>
<entry>
- <para>A standard Ant fileset. Used to include hibernate mapping
files. Remember that
- if mappings are already specified in the hibernate.cfg.xml then it
should not be
- included via the fileset as it will result in duplicate import
exceptions.</para>
+ <para>
+ A standard Ant fileset. Used to include hibernate mapping files.
Remember that if mappings are already specified in the
<filename>hibernate.cfg.xml</filename> then it should not be included via the
fileset as it will result in duplicate import exceptions.
+ </para>
</entry>
<entry>
@@ -399,20 +362,15 @@
<section>
<title>Example</title>
- <para>This example shows an example where no <emphasis>
- <property>
- <literal>hibernate.cfg.xml</literal>
- </property>
- </emphasis> exists, and a <emphasis>
- <property> hibernate.properties </property>
- </emphasis> and fileset is used instead. </para>
+ <para>
+ This example shows an example where no
<filename>hibernate.cfg.xml</filename> file exists, and a
<filename>hibernate.properties</filename> file and fileset is used instead.
+ </para>
<note>
<title>Note:</title>
- <para> Hibernate will still read any global <emphasis>
- <property>hibernate.properties</property>
- </emphasis> available in the classpath, but the specified properties
file here will
- override those values for any non-global property.</para>
+ <para>
+ Hibernate will still read any global
<filename>hibernate.properties</filename> files available in the classpath,
but the specified properties file here will override those values for any non-global
property.
+ </para>
</note>
<programlisting role="XML"><![CDATA[<hibernatetool
destdir="${build.dir}/generated">
@@ -433,26 +391,18 @@
<section>
<title>Annotation based Configuration
(<annotationconfiguration>)</title>
- <para>An
- <code><annotationconfiguration></code>
- is used when you want to read the metamodel from EJB3/Hibernate Annotations
- based POJO's.</para>
+ <para>An <code><annotationconfiguration></code> tag
is used when you want to read the metamodel from EJB3 or Hibernate Annotations based
POJO's.</para>
<important>
<title>Important:</title>
- <para>To use it remember to put the jar files needed for using hibernate
annotations in the
- classpath of the
- <code><taskdef></code>, i. e.
- hibernate-annotations.jar and hibernate-commons-annotations.jar.</para>
+ <para>
+ To use an <code><annotationconfiguration></code> tag
remember to place the JAR files required to use Hibernate annotations in the classpath of
the <code><taskdef></code>, i.e.
<filename>hibernate-annotations.jar</filename> and
<filename>hibernate-commons-annotations.jar</filename>.
+ </para>
</important>
- <para>The
- <code><annotationconfiguration></code>
- supports the same attributes as a
- <code><configuration></code>
- except that the configurationfile attribute is now required as that is from
- where an <emphasis>AnnotationConfiguration</emphasis> gets the list
of classes/packages it
- should load.</para>
+ <para>
+ The <code><annotationconfiguration></code> tag supports
the same attributes as the <code><configuration></code> tag,
with the exception being that the <code>configurationfile</code> attribute is
now required as that is where an <emphasis>AnnotationConfiguration</emphasis>
gets the list of classes and packages it should load.
+ </para>
<para>Thus the minimal usage is:</para>
@@ -470,30 +420,21 @@
<section>
<title>JPA based configuration
(<jpaconfiguration>)</title>
- <para>A <code><jpaconfiguration></code>
- is used when you want to read the metamodel from JPA/Hibernate Annotation where
- you want to use the auto-scan configuration as defined in the JPA spec (part of
EJB3). In
- other words, when you do not have a <emphasis>
- <property>hibernate.cfg.xml</property>, </emphasis> but
instead have a setup where you use
- a <emphasis>
- <property>persistence.xml</property>
- </emphasis> packaged in a JPA compliant manner.</para>
+ <para>
+ A <code><jpaconfiguration></code> tag is used when you
want to read the metamodel from JPA or Hibernate Annotation where you want to use the
auto-scan configuration as defined in the JPA specification (part of EJB3). In other
words, when you do not have a <filename>hibernate.cfg.xml</filename>, but
instead have a setup where you use a <filename>persistence.xml</filename> file
packaged in a JPA compliant manner.
+ </para>
- <para>The <code><jpaconfiguration></code>
- will simply just try and auto-configure it self based on the available
- classpath, e.g. look for <emphasis>
- <property>META-INF/persistence.xml</property>.
</emphasis></para>
+ <para>
+ The <code><jpaconfiguration></code> tag will try and
auto-configure it self based on the available classpath, e.g. look for the
<filename>META-INF/persistence.xml</filename> file.
+ </para>
- <para>The <emphasis>
- <property>persistenceunit</property>
- </emphasis> attribute can be used to select a specific persistence unit. If
no <emphasis>
- <property>persistenceunit</property>
- </emphasis> is specified it will automatically search for one and if a
unique one is found,
- use it, but if multiple persistence units are available it will
error.</para>
+ <para>
+ The <code>persistenceunit</code> attribute can be used to select a
specific persistence unit. If no <code>persistenceunit</code> attribute is
specified it will automatically search for one, and if a unique one is found, use it.
However, having multiple persistence units will result in an error.
+ </para>
- <para>To use a <code><jpaconfiguration></code>
- you will need to specify some additional jars from Hibernate EntityManager in
- the <code><taskdef></code> of the hibernatetool. The
following shows a full setup:</para>
+ <para>
+ To use a <code><jpaconfiguration></code> tag you will
need to specify some additional JARs from the Hibernate EntityManager in the
<code><taskdef></code> section of the hibernatetool. The
following demonstrates a full setup:
+ </para>
<programlisting role="XML"><![CDATA[<path
id="ejb3toolslib">
<path refid="jpatoolslib"/> <!-- ref to previously defined toolslib
-->
@@ -524,8 +465,9 @@
<note>
<title>Note:</title>
- <para>ejb3configuration was the name used in previous versions. It still
works but will emit
- a warning telling you to use <literal>jpaconfiguration</literal>
instead.</para>
+ <para>
+ <literal>ejb3configuration</literal> was the name used in previous
versions. It still works but will display a warning telling you to use
<literal>jpaconfiguration</literal> instead.
+ </para>
</note>
</section>
@@ -533,17 +475,15 @@
<section>
<title>JDBC Configuration for reverse engineering
(<jdbcconfiguration>)</title>
- <para>A <code><jdbcconfiguration></code> is used to
perform reverse engineering of the database from a JDBC connection.</para>
+ <para>A <code><jdbcconfiguration></code> tag is
used to perform reverse engineering of a database from a JDBC connection.</para>
- <para>This configuration works by reading the connection properties either
from <emphasis>
- <property>hibernate.cfg.xml</property>
- </emphasis> or <emphasis>
- <property>hibernate.properties</property>
- </emphasis> with a fileset.</para>
+ <para>
+ This configuration works by reading the connection properties either from a
<filename>hibernate.cfg.xml</filename> file or a
<filename>hibernate.properties</filename> file with a fileset.
+ </para>
- <para>The <code><jdbcconfiguration></code> has the
same attributes as a
- <code><configuration></code>
- plus the following additional attributes:</para>
+ <para>
+ The <code><jdbcconfiguration></code> tag has the same
attributes as a <code><configuration></code> tag, plus the
following additional attributes:
+ </para>
<programlisting role="XML"><![CDATA[<jdbcconfiguration
...
@@ -599,7 +539,7 @@
</entry>
<entry>
- <para>The name of a property file, e.g.
"hibernate.properties"</para>
+ <para>The name of a property file, e.g.
<filename>hibernate.properties</filename></para>
</entry>
<entry>
@@ -613,11 +553,9 @@
</entry>
<entry>
- <para>Name of a class that implements
org.hibernate.cfg.reveng.ReverseEngineeringStrategy.
- Used for setting up the strategy the tools will use to control the
reverse engineering, e.g. naming of
- properties, which tables to include/exclude etc. Using a class instead
of (or as
- addition to) a reveng.xml file gives you full programmatic control of
the reverse
- engineering.</para>
+ <para>
+ Name of a class that implements
<filename>org.hibernate.cfg.reveng.ReverseEngineeringStrategy</filename>. Used
for setting up the strategy the tools will use to control the reverse engineering, e.g.
naming of properties, which tables to include or exclude etc. Using a class instead of (or
as addition to) a <filename>reveng.xml</filename> file gives you full
programmatic control of the reverse engineering.
+ </para>
</entry>
<entry>
@@ -632,9 +570,9 @@
</entry>
<entry>
- <para>If true, tables which are pure many-to-many link tables will
be mapped as
- such. A pure many-to-many table is one which primary-key contains
exactly two
- foreign-keys pointing to other entity tables and has no other
columns.</para>
+ <para>
+ If true, tables which are pure many-to-many link tables will be mapped
as such. A pure many-to-many table is one which primary-key contains exactly two
foreign-keys pointing to other entity tables and has no other columns.
+ </para>
</entry>
<entry>
@@ -648,9 +586,10 @@
</entry>
<entry>
- <para>If true, columns named VERSION or TIMESTAMP with appropriate
types will be
- mapped with the appropriate optimistic locking corresponding to
- <code><version></code> or
<code><timestamp></code>.</para>
+ <para>
+ If true, columns named VERSION or TIMESTAMP with appropriate types will
be mapped with the appropriate optimistic locking corresponding to
+ <code><version></code> or
<code><timestamp></code>.
+ </para>
</entry>
<entry>
@@ -666,12 +605,9 @@
<section>
<title>Example</title>
- <para>Here is an example of using
<code><jdbcconfiguration></code> to generate Hibernate xml
mappings via
- <code><hbm2hbmxml></code>. The connection settings
here
- is read from a <emphasis>
- <property> hibernate.properties </property>
- </emphasis> file but could just as well have been read from a
<emphasis>
- <property>hibernate.cfg.xml</property>.
</emphasis></para>
+ <para>
+ Here is an example using a
<code><jdbcconfiguration></code> tag to generate Hibernate XML
mappings via <code><hbm2hbmxml></code>. The connection settings
used here are read from a <filename>hibernate.properties</filename> file, but
they could also have been defined in a <filename>hibernate.cfg.xml</filename>
file.
+ </para>
<programlisting role="XML"><![CDATA[<hibernatetool>
<jdbcconfiguration propertyfile="etc/hibernate.properties" />
@@ -685,20 +621,16 @@
<section>
<title>Exporters</title>
- <para>Exporters are the parts that do the actual job of converting the
hibernate metamodel into
- various artifacts, mainly code. The following section describes the current
supported set of
- exporters in the <property>Hibernate Tool</property> distribution. It
is also possible for
- userdefined exporters, that is done through the
- <code><hbmtemplate></code>
- exporter.</para>
+ <para>
+ Exporters do the actual job of converting the Hibernate metamodel into various
artifacts, mainly code. The following section describes the current supported set of
exporters in the <productname>Hibernate Tool</productname> distribution. It is
also possible to implement user defined exporters, which is done through the
<code><hbmtemplate></code> exporter.
+ </para>
<section>
<title>Database schema exporter (<hbm2ddl>)</title>
- <para><code><hbm2ddl></code> lets you run
schemaexport and schemaupdate which generates the appropriate SQL
- DDL and allow you to store the result in a file or export it directly to the
database.
- Remember that if a custom naming strategy is needed it is placed on the
configuration
- element.</para>
+ <para>
+ <code><hbm2ddl></code> lets you run schemaexport and
schemaupdate which generates the appropriate SQL DDL and allow you to store the result in
a file or export it directly to the database. Remember that if a custom naming strategy is
needed it is defined in the configuration element.
+ </para>
<programlisting role="XML"><![CDATA[<hbm2ddl
export="true|false"
@@ -754,11 +686,9 @@
</entry>
<entry>
- <para>Try and create an update script representing the
"delta"
- between what is in the database and what the mappings specify. Ignores
- create/update attributes. (<emphasis>Do *not* use against
production databases, no
- guarantees at all that the proper delta can be generated nor that the
underlying
- database can actually execute the needed
operations</emphasis>).</para>
+ <para>
+ Try and create an update script representing the
"delta" that is, between what is in the database and what the mappings
specify. Ignores create and update attributes. (<emphasis>Do *not* use against
production databases, as there are no guarantees that the proper delta can be generated,
nor that the underlying database can actually execute the required
operations</emphasis>).
+ </para>
</entry>
<entry>
@@ -772,8 +702,7 @@
</entry>
<entry>
- <para>Output will contain drop statements for the tables, indices
and
- constraints</para>
+ <para>Output will contain drop statements for the tables, indices
and constraints</para>
</entry>
<entry>
@@ -788,8 +717,7 @@
</entry>
<entry>
- <para>Output will contain create statements for the tables, indices
and
- constraints</para>
+ <para>Output will contain create statements for the tables, indices
and constraints</para>
</entry>
<entry>
@@ -860,9 +788,9 @@
<section>
<title>Example</title>
- <para>Basic example of using
<code><hbm2ddl></code>, which does not export to the
- database but simply dumps the sql to a file named <emphasis>
- <property>sql.ddl</property>. </emphasis></para>
+ <para>
+ Below is a basic example of using
<code><hbm2ddl></code>, which does not export to the database
but simply dumps the SQL to a file named <filename>sql.ddl</filename>.
+ </para>
<programlisting role="XML"><![CDATA[<hibernatetool
destdir="${build.dir}/generated">
<configuration configurationfile="hibernate.cfg.xml"/>
@@ -874,8 +802,9 @@
<section>
<title>POJO java code exporter (<hbm2java>)</title>
- <para><code><hbm2java></code> is a java
codegenerator. Options for controlling whether JDK 5 syntax can be
- used and whether the POJO should be annotated with EJB3/Hibernate
Annotations.</para>
+ <para>
+ <code><hbm2java></code> is a Java code generator.
Options for controlling whether JDK 5 syntax can be used and whether the POJO should be
annotated with EJB3/Hibernate Annotations.
+ </para>
<programlisting role="XML"><![CDATA[<hbm2java
jdk5="true|false"
@@ -925,8 +854,9 @@
</entry>
<entry>
- <para>Code will contain EJB 3 features, e.g. using annotations
from
- javax.persistence and org.hibernate.annotations</para>
+ <para>
+ Code will contain EJB 3 features, e.g. using annotations from
<code>javax.persistence</code> and
<code>org.hibernate.annotations</code>
+ </para>
</entry>
<entry>
@@ -942,7 +872,7 @@
<section>
<title>Example</title>
- <para>Basic example of using
<code><hbm2java></code> to generate POJO's that utilize jdk5
constructs.</para>
+ <para>Here is a basic example using
<code><hbm2java></code> to generate POJO's that utilize JDK5
constructs.</para>
<programlisting role="XML"><![CDATA[<hibernatetool
destdir="${build.dir}/generated">
<configuration configurationfile="hibernate.cfg.xml"/>
@@ -954,16 +884,15 @@
<section>
<title>Hibernate Mapping files exporter
(<hbm2hbmxml>)</title>
- <para><code><hbm2hbmxml></code> generates a set of
.hbm files. Intended to be used together with a
- <code><jdbcconfiguration></code>
- when performing reverse engineering, but can be used with any kind of
- configuration. e.g. to convert from annotation based pojo's to
<emphasis>
- <property>hbm.xml</property>. </emphasis></para>
+ <para>
+ <code><hbm2hbmxml></code> generates a set of
<filename>.hbm</filename> files. It is intended to be used together with a
<code><jdbcconfiguration></code> when performing reverse
engineering, but can be used with any kind of configuration e.g. to convert from
annotation based POJO's to a <filename>hbm.xml</filename> file.
+ </para>
<note>
<title>Note:</title>
- <para>Not every possible mapping transformation is possible/implemented
(contributions
- welcome) so some hand editing might be necessary.</para>
+ <para>
+ Not every possible mapping transformation is possible/implemented (contributions
welcome) so some hand editing might be required.
+ </para>
</note>
<programlisting
role="XML"><![CDATA[<hbm2hbmxml/>]]></programlisting>
@@ -978,15 +907,13 @@
<hbm2hbmxml/>
</hibernatetool>]]></programlisting>
- <para><code><hbm2hbmxml></code> is normally used
with a <code><jdbcconfiguration></code> like in the above
example, but any other configuration can also be used to
- convert between the different ways of performing mappings. Here is an example
of that,
- using an <code><annotationconfiguration></code>
- .</para>
+ <para>
+ <code><hbm2hbmxml></code> is normally used with a
<code><jdbcconfiguration></code> like in the above example, but
any other configuration can also be used to convert between the different ways of
performing mappings. Here is an example of that, using an
<code><annotationconfiguration></code>.
+ </para>
<note>
<title>Note:</title>
- <para>Not all conversions are implemented (contributions welcome), so
some hand editing
- might be necessary.</para>
+ <para>Not all conversions are implemented (contributions welcome), so
some hand editing might be necessary.</para>
</note>
<programlisting role="XML"><![CDATA[<hibernatetool
destdir="${build.dir}/generated">
@@ -999,10 +926,9 @@
<section>
<title>Hibernate Configuration file exporter
(<hbm2cfgxml>)</title>
- <para><code><hbm2cfgxml></code> generates a
<emphasis>
- <property>hibernate.cfg.xml</property>. </emphasis> Intended
to be used together with a <code><jdbcconfiguration></code>
- when performing reverse engineering, but it can be used with any kind of
- configuration. The <code><hbm2cfgxml></code> will
contain the properties used and adds mapping entries for each mapped class.</para>
+ <para>
+ <code><hbm2cfgxml></code> generates a
<filename>hibernate.cfg.xml</filename> file. It is intended to be used
together with a <code><jdbcconfiguration></code> when performing
reverse engineering, but it can be used with any kind of configuration. The
<code><hbm2cfgxml></code> will contain the properties that are
used and adds mapping entries for each mapped class.
+ </para>
<programlisting role="XML"><![CDATA[<hbm2cfgxml
ejb3="true|false"
@@ -1039,8 +965,9 @@
</entry>
<entry>
- <para>The generated cfg.xml will have <mapping
class=".."/>, opposed
- to <mapping resource="..."/> for each
mapping.</para>
+ <para>
+ The generated <filename>cfg.xml</filename> will have
<mapping class=".."/>, opposed to <mapping
resource="..."/> for each mapping.
+ </para>
</entry>
<entry>
@@ -1058,8 +985,7 @@
<section>
<title>Documentation exporter (<hbm2doc>)</title>
- <para><code><hbm2doc></code>
- generates html documentation a'la javadoc for the database schema
et.al.</para>
+ <para><code><hbm2doc></code> generates HTML
documentation similar to Javadoc for the database schema et.al.</para>
<programlisting
role="XML"><![CDATA[<hbm2doc/>]]></programlisting>
</section>
@@ -1067,8 +993,9 @@
<section>
<title>Query exporter (<query>)</title>
- <para><code><query></code> is used to execute a HQL
query statements and optionally sends the output to a
- file. It can be used for verifying the mappings and for basic data
extraction.</para>
+ <para>
+ <code><query></code> is used to execute HQL query
statements and optionally redirects the output to a file. It can be used for verifying the
mappings and for basic data extraction.
+ </para>
<programlisting role="XML"><![CDATA[<query
destfile="filename">
@@ -1076,30 +1003,31 @@
</query>
]]></programlisting>
- <para>Currently one session is opened and used for all queries and the query
is executed via
- the list() method. In the future more options might become available, like
performing
- executeUpdate(), use named queries and etc.</para>
+ <para>
+ Currently one session is opened and used for all queries, which are executed via
the <code>list()</code> method. In the future more options might become
available, like executing <code>executeUpdate()</code>, use named queries and
etc.
+ </para>
<para/>
<section>
<title>Examples</title>
- <para>The simplest usage of <code><query></code>
will just execute the query without dumping to a file. This can be used to
- verify that queries can actually be performed.</para>
+ <para>
+ The simplest usage of <code><query></code> will
execute the query without dumping to a file. This can be used to verify that queries can
be performed successfully.
+ </para>
<programlisting role="XML"><![CDATA[<hibernatetool>
<configuration configurationfile="hibernate.cfg.xml"/>
<query>from java.lang.Object</query>
</hibernatetool>]]></programlisting>
- <para>Multiple queries can be executed by nested
<code><hql></code> elements.
- In this example we also let the output be dumped to <emphasis>
- <property>queryresult.txt</property>.
</emphasis></para>
+ <para>
+ Multiple queries can be executed by nested
<code><hql></code> elements. In this example we also let the
output be dumped to the <filename>queryresult.txt</filename> file.
+ </para>
<note>
<title>Note:</title>
- <para> Currently the dump is simply a call to toString on each
element.</para>
+ <para> Currently the dump is performed by calling the
<code>toString()</code> function on each element.</para>
</note>
<programlisting role="XML"><![CDATA[<hibernatetool>
@@ -1115,7 +1043,7 @@
<section id="hbmtemplate">
<title>Generic Hibernate metamodel exporter
(<hbmtemplate>)</title>
- <para>Generic exporter that can be controlled by a user provides a template
or class.</para>
+ <para>Below is an example of a generic exporter that can be controlled by a
user provided template or class.</para>
<programlisting role="XML"><![CDATA[<hbmtemplate
filepattern="{package-name}/{class-name}.ftl"
@@ -1125,16 +1053,16 @@
<note>
<title>Note:</title>
- <para>Previous versions of the tools used Velocity. We are now using
Freemarker which
- provides us much better exception and error handling.</para>
+ <para>Previous versions of the tools used
<productname>Velocity</productname>. We are now using
<productname>Freemarker</productname>, which provides much better exception
and error handling.
+ </para>
</note>
<section>
<title>Exporter via <hbmtemplate></title>
- <para>The following is an example of reverse engineering via
- <code><jdbcconfiguration></code> and usage of a
custom Exporter via the
- <code><hbmtemplate></code>.</para>
+ <para>
+ The following is an example of reverse engineering via a
<code><jdbcconfiguration></code> tag and the use of a custom
Exporter via the <code><hbmtemplate></code> tag.
+ </para>
<programlisting role="XML"><![CDATA[ <hibernatetool
destdir="${destdir}">
<jdbcconfiguration
@@ -1156,11 +1084,9 @@
<section>
<title>Relevant Resources Links</title>
- <para>Read more about <ulink
url="http://velocity.apache.org/">Velocity</ulink> and <ulink
-
url="http://freemarker.org/">Freemarker</ulink> to find
out why using the last is better
- or refer to Max Andersen discussion on the topic in <ulink
-
url="http://in.relation.to/2110.lace;jsessionid=3462F47B17556604C15DF1B96572E940"
- >"A story about FreeMarker and
Velocity"</ulink>.</para>
+ <para>
+ You can read more about <ulink
url="http://velocity.apache.org/">Velocity</ulink> and <ulink
url="http://freemarker.org/">Freemarker</ulink> to find out why using
the latter is better or refer to Max Andersens discussion on the topic in <ulink
url="http://in.relation.to/2110.lace;jsessionid=3462F47B17556604C15DF1B96572E940">"A
story about FreeMarker and Velocity"</ulink>.
+ </para>
</section>
</section>
</section>
@@ -1170,57 +1096,44 @@
<section>
<title>Using properties to configure Exporters</title>
- <para>Exporters can be controlled by user properties. The user properties are
specified via
- <code><property></code>
- or
- <code><propertyset></code>
- and each exporter will have access to them directly in the templates and via
- <property>Exporter.setProperties()</property>.</para>
+ <para>
+ Exporters can be controlled by user properties. These user properties are specified
via a <code><property></code> or
<code><propertyset></code> tag, and each exporter will have
access to them directly in the templates and via
<code>Exporter.setProperties()</code>.
+ </para>
<section>
- <title><property> and
- <propertyset></title>
+ <title><property> and
<propertyset></title>
- <para>The <code><property></code>
- allows you bind a string value to a key. The value will be available in the
- templates via <code>$<key></code>.
- The following example will assign the string value
- <code>"true"</code>
- to the variable
- <code>$descriptors</code>
- .</para>
+ <para>
+ The <code><property></code> tag allows you bind a string
value to a key. The value will be available in the templates via the
<code>$<key></code> tag. The following example will assign the
string value <code>"true"</code> to the variable
<code>$descriptors</code>.
+ </para>
<programlisting role="XML"><![CDATA[<property
key="descriptors" value="true"/>]]></programlisting>
- <para>Most times using <code><property></code> is
enough for specifying the properties needed for the exporters. Still the ant
- tools supports the notion of <code><propertyset></code>
that is used for grouping a set of properties. More about the functionality of
<code><propertyset></code>
- is explained in detail in the <ulink
url="http://ant.apache.org/manual/">Ant
- manual</ulink>.</para>
+ <para>
+ Usually using the <code><property></code> tag is enough
when specifying the properties required by the exporters. Still, the Ant tools supports
the notion of a <code><propertyset></code> which is used for
grouping a set of properties. More about the functionality of
<code><propertyset></code> is can be found in the <ulink
url="http://ant.apache.org/manual/">Ant manual</ulink>.
+ </para>
</section>
<section>
<title>Getting access to user specific classes</title>
- <para>If the templates need to access some user class it becomes possible by
specifying a <code>
- "toolclass"</code> in the properties.</para>
+ <para>It is possible for the templates to access user classes by specifying a
<code>"toolclass"</code> in the properties.</para>
- <programlisting role="XML"><![CDATA[<property
key="hibernatetool.sometool.toolclass"
value="x.y.z.NameOfToolClass"/>
-]]></programlisting>
+ <programlisting role="XML"><![CDATA[<property
key="hibernatetool.sometool.toolclass"
value="x.y.z.NameOfToolClass"/>]]></programlisting>
- <para>Placing the above <code><property></code> tag
in <code><hibernatetool></code>
- or inside any exporter will automatically create an instance of
- <literal>x.y.z.NameOfToolClass</literal> and it will be available
in the templates as
- <literal>$sometool</literal>. This is useful to delegate logic and
code generation to java
- code instead of placing such logic in the templates.</para>
+ <para>
+ Placing the above <code><property></code> tag in the
<code><hibernatetool></code> tag or inside any exporter will
automatically create an instance of <code>x.y.z.NameOfToolClass</code> which
will be available in the templates as <code>$sometool</code>. This is useful
to delegate logic and code generation to Java code instead of placing such logic in the
templates.
+ </para>
<section>
<title>Example</title>
- <para>Here is an example that uses
<code><hbmtemplate></code>
- together with <code><property></code> which will be
available to the templates/exporter. </para>
+ <para>
+ Here is an example that uses the
<code><hbmtemplate></code> tag together with the
<code><property></code> tag, which will be available to the
templates and exporter.
+ </para>
<note>
<title>Note:</title>
- <para> This example actually simulates what
<code><hbm2java></code> actually does.</para>
+ <para> This example actually simulates what the
<code><hbm2java></code> tag does.</para>
</note>
<programlisting role="XML"><![CDATA[<hibernatetool
destdir="${build.dir}/generated">
Modified: branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/codegen.xml
===================================================================
--- branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/codegen.xml 2011-07-18
01:51:18 UTC (rev 32974)
+++ branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/codegen.xml 2011-07-18
01:59:12 UTC (rev 32975)
@@ -2,28 +2,22 @@
<chapter id="codegen">
<title>Controlling POJO code generation</title>
- <para>When using <code><hbm2java></code> or the eclipse
plugin to generate POJO java code you have the possibility to control
- certain aspects of the code generation. This is primarily done with the
<code><meta></code>
- tag in the mapping files. The following section describes the possible <code>
- <meta>
- </code> tags and their use.</para>
+ <para>
+ When using the <code><hbm2java></code> tag or the Eclipse
plugin to generate POJO Java code you have the ability to control certain aspects of the
code generation process. This is primarily done with the
<code><meta></code> tag in the mapping files. The following
section describes the possible <code><meta></code> tags and
their use.
+ </para>
<section>
<title>The <meta> attribute</title>
- <para>The <code><meta></code> tag is a simple way of
annotating the <emphasis>
- <property>hbm.xml</property>
- </emphasis> with information, so tools have a natural place to store/read
information that is
- not directly related to the Hibernate core.</para>
+ <para>
+ The <code><meta></code> tag is a simple way of annotating
the <filename>hbm.xml</filename> file with information, so tools have a
natural place to store and read information that is not directly related to the Hibernate
core.
+ </para>
- <para>You can use the <code><meta></code> tag to e.g.
tell <code><hbm2java></code>
- to only generate <emphasis>
- <property>"protected"</property>
- </emphasis> setters, have classes always implement a certain set of
interfaces or even have
- them extend a certain base class and even more.</para>
+ <para>
+ As an example, you can use the <code><meta></code> tag to
tell the <code><hbm2java></code> tag to only generate
<code>"protected"</code> setters, have classes always
implement a certain set of interfaces, have them extend a certain base class and more.
+ </para>
- <para>The following example shows how to use various
<code><meta></code>
- attributes and the resulting java code.</para>
+ <para>The following example shows how to use various
<code><meta></code> attributes and the resulting Java
code.</para>
<programlisting role="XML"><![CDATA[<class
name="Person">
<meta attribute="class-description">
@@ -40,10 +34,9 @@
</property>
</class>]]></programlisting>
- <para>The above <emphasis>
- <property>hbm.xml</property>
- </emphasis> will produce something like the following (code shortened for
better
- understanding). Notice the Javadoc comment and the protected set
methods:</para>
+ <para>
+ The above <filename>hbm.xml</filename> file will produce something like
the following (the code has been abbreviated for clarity). Notice the Javadoc comment and
the protected set methods:
+ </para>
<programlisting role="JAVA"><![CDATA[// default package
@@ -112,7 +105,7 @@
<literal>class-description</literal>
</entry>
- <entry>inserted into the javadoc for classes</entry>
+ <entry>inserted into the Javadoc for classes</entry>
</row>
<row>
@@ -120,7 +113,7 @@
<literal>field-description</literal>
</entry>
- <entry>inserted into the javadoc for fields/properties</entry>
+ <entry>inserted into the Javadoc for fields and
properties</entry>
</row>
<row>
@@ -192,7 +185,7 @@
<literal>default-value</literal>
</entry>
- <entry>default initialization value for a field</entry>
+ <entry>Default initialization value for a field.</entry>
</row>
<row>
@@ -200,7 +193,7 @@
<literal>use-in-tostring</literal>
</entry>
- <entry>include this property in the
<literal>toString()</literal></entry>
+ <entry>Include this property in the <code>toString()</code>
method.</entry>
</row>
<row>
@@ -208,9 +201,9 @@
<literal>use-in-equals</literal>
</entry>
- <entry>include this property in the
<literal>equals()</literal> and
- <literal>hashCode()</literal> method. If no use-in-equals is
specified, no
- equals/hashcode will be generated.</entry>
+ <entry>
+ Include this property in the <code>equals()</code> and
<code>hashCode()</code> methods. If no use-in-equals is specified, no equals
or hashcode method will be generated.
+ </entry>
</row>
<row>
@@ -218,7 +211,7 @@
<literal>gen-property</literal>
</entry>
- <entry>property will not be generated if false (use with
care)</entry>
+ <entry>Property will not be generated if false (use with
care).</entry>
</row>
<row>
@@ -226,8 +219,7 @@
<literal>property-type</literal>
</entry>
- <entry>Overrides the default type of property. Use this with any
tag's to specify the
- concrete type instead of just Object.</entry>
+ <entry>Overrides the default type of property. Use this with any
tag's to specify the concrete type instead of just
<code>Object</code>.</entry>
</row>
<row>
@@ -249,56 +241,36 @@
</tgroup>
</table>
- <para>Attributes declared via the
<code><meta></code>
- tag are per default <emphasis>
- <property>"inherited"</property>
- </emphasis> inside an <emphasis>
- <property>hbm.xml</property>
- </emphasis> file.</para>
+ <para>
+ Attributes declared via the <code><meta></code> tag
<code>"inherited"</code> inside an
<code>hbm.xml</code> file by default.
+ </para>
- <para>What does that mean? It means that if you e.g want to have all your
classes implement
- <property>IAuditable</property> then you just add an <code>
<meta
-
attribute="implements">IAuditable</meta></code> in
the top of the <emphasis>
- <property>hbm.xml</property>
- </emphasis> file, just after
<code><hibernate-mapping></code>. Now all classes defined
- in that <emphasis>
- <property>hbm.xml</property>
- </emphasis> file will implement
<property>IAuditable</property>!</para>
+ <para>
+ What does that mean? As an example if you want to have all your classes implement
<code>IAuditable</code> then you just add <code> <meta
attribute="implements">IAuditable</meta></code> in
the top of the <filename>hbm.xml</filename> file, just after
<code><hibernate-mapping></code>. Now all classes defined in
that <filename>hbm.xml</filename> file will implement
<code>IAuditable</code>.
+ </para>
<note>
<title>Note:</title>
- <para>This applies to <emphasis>all</emphasis>
- <code><meta></code>-tags. Thus it can also e.g. be used
to specify that
- all fields should be declare protected, instead of the default private. This is
done by
- adding <code><meta
-
attribute="scope-field">protected</meta></code> at
e.g. just under
- the <code><class></code> tag and all fields of that
class will be
- protected.</para>
+ <para>
+ This applies to <emphasis>all</emphasis>
<code><meta></code>-tags. Thus it can also be used to specify
that all fields should be declare <code>protected</code>, instead of the
default <code>private</code>. This is done by adding <code><meta
attribute="scope-field">protected</meta></code> just
under the <code><class></code> tag, and all fields of that class
will be <code>protected</code>.
+ </para>
</note>
- <para>To avoid having a <code><meta></code>
- tag inherited then you can simply specify <code> inherit =
"false"</code>
- for the attribute, e.g. <code> <meta attribute =
"scope-class" inherit =
- "false">public abstract</meta></code> will
restrict the <emphasis>
- <property>"class-scope"</property>
- </emphasis> to the current class, not the subclasses.</para>
+ <para>
+ To avoid having a <code><meta></code> tag inherited then
you can specify <code> inherit = "false"</code> for the attribute.
For example <code> <meta attribute = "scope-class" inherit =
"false">public abstract</meta></code> will restrict
the <code>"class-scope"</code> to the current class, not the
subclasses.
+ </para>
<section>
<title>Recommendations</title>
- <para>The following are some good practices when using
- <code><meta></code>
- attributes.</para>
+ <para>The following are some good practices to employ when using
<code><meta></code> attributes.</para>
<section>
- <title>Dangers of a class level <property>use-in-string and
use-in-equals</property> meta
- attributes when having bi-directional associations</title>
+ <title>Dangers of a class level <property>use-in-string and
use-in-equals</property> meta attributes when using bi-directional
associations</title>
- <para>If we have two entities with a bi-directional association between
them and define at
- class scope level the meta attributes: <emphasis>
- <property>use-in-string</property>, </emphasis>
- <emphasis>
- <property>use-in-equals</property>:
</emphasis></para>
+ <para>
+ In the following example we have two entities with a bi-directional association
between them and define the <code>use-in-string</code> and
<code>use-in-equals</code> meta attributes at the class scope level the meta
attributes:
+ </para>
<programlisting role="XML"><![CDATA[<hibernate-mapping>
<class name="Person">
@@ -308,9 +280,7 @@
</class>
</hibernate-mapping>]]></programlisting>
- <para>And for <emphasis>
- <property>Event.hbm</property>
- </emphasis> file:</para>
+ <para>Here is the <filename>Event.hbm</filename>
file:</para>
<programlisting role="XML"><![CDATA[<hibernate-mapping>
<class name="events.Event" table="EVENTS">
@@ -328,21 +298,15 @@
</class>
</hibernate-mapping>]]></programlisting>
- <para>Then <code><hbm2java></code>
- will assume you want to include all properties and collections in the
- <code>toString()/equals()</code> methods and this can result in
infinite
- recursive calls.</para>
+ <para>
+ In this situation the <code><hbm2java></code> tag will
assume you want to include all properties and collections in the
<code>toString()</code> and <code>equals()</code> methods. This
can result in infinite recursive calls.
+ </para>
- <para>To remedy this you have to decide which side of the association will
include the other
- part (if at all) in the <code>toString()/equals()</code> methods.
Therefore it is
- not a good practice to put at class scope such <emphasis>
- <property>meta</property>
- </emphasis> attributes, unless you are defining a class without
bi-directional
- associations.</para>
+ <para>
+ To remedy this you have to decide which side of the association will include the
other part (if at all) in the <code>toString()</code> and
<code>equals()</code> methods. Therefore it is not a good practice to define
these <code>meta</code> attributes at the class scope, unless you are defining
a class without bi-directional associations.
+ </para>
- <para>We recommend instead to add the <emphasis>
- <property>meta</property>
- </emphasis> attributes at the property level:</para>
+ <para>Instead it is recommended that the <code>meta</code>
attributes are defined at the property level, like so:</para>
<programlisting role="XML"><![CDATA[<hibernate-mapping>
<class name="events.Event" table="EVENTS">
@@ -362,7 +326,7 @@
</class>
</hibernate-mapping>]]></programlisting>
- <para>and now for <property>Person</property>:</para>
+ <para>and for <code>Person</code>:</para>
<programlisting role="XML"><![CDATA[<hibernate-mapping>
<class name="Person">
@@ -385,70 +349,53 @@
</section>
<section>
- <title>Be aware of putting at class scope level <meta>
- attributeuse-in-equals</title>
+ <title>Be aware of putting at class scope level <meta>
attributeuse-in-equals</title>
- <para>For <code>equal()/hashCode()</code> method generation,
you have to take into
- account that the attributes that participate on such method definition, should
take into
- account only attributes with business meaning (the name, social security
number, etc, but
- no generated id's, for example).</para>
+ <para>
+ Only attributes with business meaning (e.g. the name, social security number,
etc, but no generated id's) should be referenced when calculating the return value for
the <code>equal()</code> and <code>hashCode()</code> methods.
+ </para>
- <para>This is important because Java's hashbased collections, such as
- <property>java.util.Set</property> relies on
<property>equals()</property> and
- <property>hashcode()</property> to be correct and not change for
objects in the set;
- this can be a problem if the id gets assigned for an object after you inserted
it into a
- set.</para>
+ <para>
+ This is important because Java's hashbased collections, such as
<code>java.util.Set</code>, rely on <code>equals()</code> and
<code>hashcode()</code> being correct and not changing for objects in the set;
this can be a problem if the id gets assigned for an object after you inserted it into a
set.
+ </para>
- <para>Therefore automatically configuration of the generation of
- <property>equals()/hashCode()</property> methods specifying at
class scope level the <code><meta></code> attribute
<emphasis>
- <property>use-in-equals</property>
- </emphasis> could be a dangerous decision that could produce non
expected
- side-effect.</para>
+ <para>
+ Therefore automatically configuration of the generation of
<code>equals()</code> and <code>hashCode()</code> methods
specifying the <code><meta></code> attribute
<code>use-in-equals</code> at class scope level could be a dangerous decision
that could produce unexpected side-effects.
+ </para>
- <para><ulink
url="http://www.hibernate.org/109.html">On
www.hibernate.org </ulink> you can get more in-depth
- explanation on the subject of <property>equals()</property> and
- <property>hashcode()</property>.</para>
+ <para>
+ On <ulink
url="http://www.hibernate.org/109.html">www.hibernate.org </ulink> you
can find more in-depth explanation on the subject of <code>equals()</code> and
<code>hashcode()</code> methods.
+ </para>
</section>
</section>
<section>
<title>Advanced <meta> attribute examples</title>
- <para>This section shows an example for using meta attributes (including
userspecific
- attributes) together with the code generation features in
<property>Hibernate
- Tools</property>.</para>
+ <para>
+ This section shows an example for using meta attributes (including user specific
attributes) together with the code generation features in <productname>Hibernate
Tools</productname>.
+ </para>
- <para>The usecase being implemented is to automatically insert some pre- and
post-conditions
- into the getter and setters of the generated POJO. </para>
+ <para>The example shown below automatically inserts some pre and post
conditions into the getter and setter methods of the generated POJO. </para>
<section>
<title>Generate pre/post-conditions for methods</title>
- <para>With a <code> <meta
attribute="class-code"></code>, you can add
- additional methods on a given class, nevertheless such
<code><meta></code>
- attribute can not be used at a property scope level and
<property>Hibernate
- Tools</property> does not provide such <code>
- ><meta>
- </code> attributes.</para>
+ <para>
+ With <code> <meta
attribute="class-code"></code> you can add additional methods on a
given class. However, such <code><meta></code> attributes can
not be used at a property scope level and <property>Hibernate Tools</property>
does not provide such <code><meta></code> attributes.
+ </para>
- <para>A possible solution for this is to modify the freemarker templates
responsible for
- generating the POJO's. If you look inside <emphasis>
- <property>hibernate-tools.jar</property>, </emphasis> you
can find the template: <emphasis>
- <property>pojo/PojoPropertyAccessor.ftl</property>
- </emphasis></para>
+ <para>
+ A possible solution for this is to modify the Freemarker templates responsible
for generating the POJOs. If you look inside the
<filename>hibernate-tools.jar</filename> archive, you can find the template
<filename>pojo/PojoPropertyAccessor.ftl</filename>.
+ </para>
- <para>This file is as the name indicates used to generate property
accessors for
- pojo's.</para>
+ <para>As its name indicates, this file is used to generate property
accessors for POJOs.</para>
- <para>Extract the <emphasis>
- <property>PojoPropertyAccessor.ftl</property>
- </emphasis> into a local folder i.e. <emphasis>
- <property>${hbm.template.path}</property>, </emphasis>
respecting the whole path, for
- example: <emphasis>
-
<property>${hbm.template.path}/pojo/PojoPropertyAccessor.ftl</property>
- </emphasis></para>
+ <para>
+ Extract the <filename>PojoPropertyAccessor.ftl</filename> file into
a local folder e.g. <filename>${hbm.template.path}</filename>, respecting the
whole path, for example:
<filename>${hbm.template.path}/pojo/PojoPropertyAccessor.ftl</filename>.
+ </para>
- <para>The contents of the file is something like this:</para>
+ <para>The contents of the file will be something like this:</para>
<programlisting role="XML"><![CDATA[<#foreach property in
pojo.getAllPropertiesIterator()>
${pojo.getPropertyGetModifiers(property)}
@@ -464,8 +411,9 @@
}
</#foreach>]]></programlisting>
- <para>We can add conditionally pre/post-conditions on our
<literal>set</literal> method
- generation just adding a little Freemarker syntax to the above source
code:</para>
+ <para>
+ We can add pre and post conditions on our <code>set</code> method
generation just by adding a little Freemarker syntax to the above source code:
+ </para>
<programlisting role="XML"><![CDATA[<#foreach property in
pojo.getAllPropertiesIterator()>
${pojo.getPropertyGetModifiers(property)}
@@ -489,19 +437,13 @@
</#foreach>]]>
</programlisting>
- <para>Now if in any <emphasis>
- <property>.hbm.xml</property>
- </emphasis> file we define the <emphasis>
- <property><meta></property>
- </emphasis> attributes: <code>pre-cond</code> or
<code>post-cond</code>, their
- contents will be generated into the body of the relevant
<literal>set</literal>
- method.</para>
+ <para>
+ Now if in any <filename>.hbm.xml</filename> file we define the
<code><meta></code> attributes:
<code>pre-cond</code> or <code>post-cond</code>, and their
contents will be generated into the body of the relevant <code>set</code>
method.
+ </para>
- <para>As an example let us add a pre-condition for property
<code>name</code>
- preventing no <property>Person</property> can have an empty name.
Hence we have to modify
- the <emphasis>
- <property>Person.hbm.xml</property>
- </emphasis> file like this:</para>
+ <para>
+ As an example let us add a pre-condition for the <code>name</code>
property which will prevent the <code>Person</code> class from having an empty
name. To achieve this we have to modify the
<filename>Person.hbm.xml</filename> file like so:
+ </para>
<programlisting role="XML"><![CDATA[<hibernate-mapping>
<class name="Person">
@@ -520,18 +462,15 @@
<note>
<title>Note:</title>
- <para>I) To escape the & symbol we put &amp;. You can
use
- <code> <![CDATA[]]></code> instead.</para>
- <para>II) Note that we are referring to "firstName" directly
and this is the parameter
- name not the actual field name. If you want to refer the field you have to
use
- "this.firstName" instead. </para>
+ <para>I) To escape the <code>&</code> symbol we put
<code>&</code><code>amp</code><code>;</code>.
You could use <code> <![CDATA[]]></code> instead.</para>
+ <para>
+ II) Note that we are referring to <code>firstName</code> directly
and this is the parameter name not the actual field name. If you want to refer the field
you have to use <code>this.firstName</code> instead.
+ </para>
</note>
- <para>Finally we have to generate the <emphasis>
- <property>Person.java</property>
- </emphasis> class, for this we can use both Eclipse and Ant as long as
you remember to set
- or fill in the templatepath setting. For Ant we configure
<code><hibernatetool></code>
- task via <literal>the templatepath</literal> attribute as
in:</para>
+ <para>
+ Finally we have to generate the <filename>Person.java</filename>
class. For this we can use either Eclipse or Ant, as long as you remember to set or fill
in the <code>templatepath</code> setting. For Ant we configure the
<code><hibernatetool></code> task via the
<code>templatepath</code> attribute as in:
+ </para>
<programlisting role="XML"><![CDATA[
<target name="hbm2java">
@@ -552,12 +491,9 @@
</hibernatetool>
</target>]]></programlisting>
- <para>Invoking the target
<code><hbm2java></code>
- will generate on the <emphasis>
- <property>${hbm2java.dest.dir}</property>
- </emphasis> the file <emphasis>
- <property>Person.java</property>
- </emphasis>:</para>
+ <para>
+ Invoking the target <code><hbm2java></code> will
generate file <filename>Person.java</filename> in
<filename>${hbm2java.dest.dir}</filename>:
+ </para>
<programlisting role="JAVA"><![CDATA[// default package
import java.io.Serializable;
@@ -594,22 +530,19 @@
}
}]]></programlisting>
- <para>In conclusion, this document is intended to introduce you to
Hibernate plugin specific
- features related to tools bath for the Eclipse and Ant tasks.</para>
+ <para>
+ In conclusion, this document is intended to introduce you to Hibernate plugin
specific features related to tools both for the Eclipse and Ant tasks.
+ </para>
- <para>In the <xref linkend="plugins"/> chapter
you've learnt
- about a set of wizards for creating Mapping files, Configuration file, Console
- Configuration, got familiar with Mapping and Configuration files editors,
tooling for
- organizing and controlling Reverse Engineering, Hibernate Console and Mapping
diagram as
- well.</para>
+ <para>
+ In <xref linkend="plugins"/> you've learned about a set
of wizards for creating Mapping files, Configuration files, Console Configurations, become
familiar with Mapping and Configuration files editors, tooling for organizing and
controlling Reverse Engineering, Hibernate Console and Mapping diagrams.
+ </para>
- <para>The rest chapters have shown the aspects of using the
<property>Hibernate
- Tools</property> via Ant tasks.</para>
+ <para>The rest chapters have explored the use of the
<productname>Hibernate Tools</productname> via Ant tasks.</para>
- <para>Please, visit <ulink
-
url="http://www.jboss.com/index.html?module=bb&op=viewforum&...
- Tools Users Forum</ulink> to leave questions or/and suggestions on the
topic. Your
- feedback is always appreciated.</para>
+ <para>
+ Please visit <ulink
url="http://www.jboss.com/index.html?module=bb&op=viewforum&...
Tools Users Forum</ulink> to leave questions or/and suggestions on the topic. Your
feedback is always appreciated.
+ </para>
</section>
</section>
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/codegenarchitecture.xml
===================================================================
---
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/codegenarchitecture.xml 2011-07-18
01:51:18 UTC (rev 32974)
+++
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/codegenarchitecture.xml 2011-07-18
01:59:12 UTC (rev 32975)
@@ -1,112 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<chapter id="codegenarchitecture">
- <title>Code generation architecture</title>
+ <title>Code generation architecture</title>
- <para>The code generation mechanism in the <property>Hibernate
Tools</property> consists of a few
- core concepts. This section explains their overall structure which are the same for
the Ant and
- Eclipse tools.</para>
+ <para>
+ The code generation mechanism in <productname>Hibernate Tools</productname>
consists of a few core concepts. This section explains their overall structure, which is
the same for the <productname>Ant</productname> and
<productname>Eclipse</productname> tools.
+ </para>
- <section>
- <title>Hibernate Meta Model</title>
+ <section>
+ <title>Hibernate Meta Model</title>
- <para>The meta model is the model used by Hibernate Core to perform its object
relational
- mapping. The model includes information about tables, columns, classes,
properties,
- components, values, collections etc. The API is in
<literal>org.hibernate.mapping</literal>
- and its main entry point is the <property>Configuration</property>
class, the same class that is
- used to build a session factory.</para>
+ <para>
+ The meta model is the model used by <productname>Hibernate
Core</productname> to perform its object relational mapping. The model includes
information about tables, columns, classes, properties, components, values, collections
etc. The API is in the <code>org.hibernate.mapping</code> package and its main
entry point is the <code>Configuration</code> class: the same class that is
used to build a session factory.
+ </para>
- <para>The model represented by the
<property>Configuration</property> class can be build in many
- ways. The following list the currently supported ones in <property>Hibernate
Tools</property>. </para>
+ <para>
+ The model represented by the <code>Configuration</code> class can be built
in many ways:
+ </para>
- <para>
- <itemizedlist>
- <listitem>
- <para>A Core configuration uses Hibernate Core and supports reading
<emphasis>
- <property>hbm.xml</property>
- </emphasis> files, requires a <emphasis>
- <property>hibernate.cfg.xml</property>
- </emphasis>. Named core in Eclipse and
- <code><configuration></code>
- in ant.</para>
- </listitem>
+ <para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ A Core configuration uses <productname>Hibernate Core</productname> and
supports reading <filename>hbm.xml</filename> files, and requires a
<filename>hibernate.cfg.xml</filename> file. This is referred to as
<emphasis>Core</emphasis> in Eclipse and
<code><configuration></code> in Ant.
+ </para>
+ </listitem>
- <listitem>
- <para>An Annotation configuration uses Hibernate Annotations and supports
<emphasis>
- <property>hbm.xml</property>
- </emphasis> and annotated classes, requires a <emphasis>
- <property>hibernate.cfg.xml</property>
- </emphasis>. Named annotations in Eclipse and
- <code><annotationconfiguration></code>
- in ant.</para>
- </listitem>
+ <listitem>
+ <para>
+ An Annotation configuration uses <productname>Hibernate
Annotations</productname>, supports <filename>hbm.xml</filename> files
and annotated classes, and requires a <filename>hibernate.cfg.xml</filename>
file. This is referred to as <emphasis>Annotations</emphasis> in Eclipse and
<code><annotationconfiguration></code> in Ant.</para>
+ </listitem>
- <listitem>
- <para>A JPA configuration uses a Hibernate EntityManager and supports
<emphasis>
- <property>hbm.xml</property>
- </emphasis> and annotated classes requires that the project has a
<emphasis>
- <property>META-INF/persistence.xml</property>
- </emphasis> in its classpath. Named JPA in Eclipse and
- <code><jpaconfiguration></code>
- in ant.</para>
- </listitem>
+ <listitem>
+ <para>
+ A JPA configuration uses a <productname>Hibernate
EntityManager</productname> and supports <filename>hbm.xml</filename>
files and annotated classes, and requires that the project has a
<filename>META-INF/persistence.xml</filename> file in its classpath. This is
referred to as <emphasis>JPA</emphasis> in Eclipse and
<code><jpaconfiguration></code> in Ant.</para>
+ </listitem>
- <listitem>
- <para>A JDBC configuration uses <property>Hibernate
Tools</property> reverse engineering
- and reads its mappings via JDBC metadata + additional reverse engineering
files
- (reveng.xml). Automatically used in Eclipse when doing reverse engineering
from JDBC and
- named
- <code><jdbcconfiguration></code>
- in ant.</para>
- </listitem>
- </itemizedlist>
- </para>
+ <listitem>
+ <para>
+ A JDBC configuration uses <property>Hibernate Tools</property> reverse
engineering and reads its mappings via JDBC metadata + additional reverse engineering
files (<filename>reveng.xml</filename>). Automatically used in Eclipse when
doing reverse engineering from JDBC and referred to as
<code><jdbcconfiguration></code> in Ant.</para>
+ </listitem>
+ </itemizedlist>
+ </para>
- <para>In most projects you will normally use only one of the Core, Annotation
or JPA
- configuration and possibly the JDBC configuration if you are using the reverse
engineering
- facilities of <property>Hibernate Tools</property>. </para>
+ <para>
+ In most projects you will normally use only one of the
<emphasis>Core</emphasis>, <emphasis>Annotation</emphasis> or
<emphasis>JPA</emphasis> configuration and possibly the JDBC configuration if
you are using the reverse engineering facilities of <productname>Hibernate
Tools</productname>.
+ </para>
- <note>
- <title>Note:</title>
- <para>No matter which Hibernate Configuration type you are using
<property>Hibernate
- Tools</property> supports them.</para>
- </note>
+ <note>
+ <title>Note:</title>
+ <para>Hibernate Tools has support for all kinds of Hibernate
Configurations.</para>
+ </note>
- <para>The following drawing illustrates the core concepts:</para>
+ <para>The following drawing illustrates the core concepts:</para>
- <para>
- <figure>
- <title>Hibernate Core Concepts</title>
- <mediaobject>
- <imageobject role="fo">
- <imagedata
fileref="images/code_generation/code_generation_1.png"
format="PNG"/>
- </imageobject>
+ <para>
+ <figure>
+ <title>Hibernate Core Concepts</title>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata fileref="images/code_generation/code_generation_1.png"
format="PNG"/>
+ </imageobject>
- <imageobject role="html">
+ <imageobject role="html">
- <imagedata align="center"
fileref="images/code_generation/code_generation_1.png"
format="PNG"/>
- </imageobject>
- </mediaobject>
- </figure>
- </para>
+ <imagedata align="center"
fileref="images/code_generation/code_generation_1.png"
format="PNG"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </para>
- <para>The code generation is done based on the Configuration model no matter
which type of
- configuration have been used to create the meta model, and thus the code generation
is
- independent on the source of the meta model and represented via
Exporters.</para>
- </section>
+ <para>
+ The code generation is performed based on the Configuration model no matter which type
of configuration has been used to create the meta model, and thus the code generation is
independent on the source of the meta model and represented via Exporters.
+ </para>
+ </section>
- <section>
- <title>Exporters</title>
+ <section>
+ <title>Exporters</title>
- <para>Code generation is done in so called Exporters. An
<code>Exporter</code> is handed a
- Hibernate Meta Model represented as a <code>Configuration</code>
instance and it is then
- the job of the exporter to generate a set of code artifacts.</para>
+ <para>
+ Code generation is performed by an Exporters. An
<emphasis>Exporter</emphasis> is handed a Hibernate Meta Model represented as
a <code>Configuration</code> instance, and it is then the job of the exporter
to generate a set of code artifacts.
+ </para>
- <para>The tools provides a default set of Exporter's which can be used in
both Ant and the
- Eclipse UI. Documentation for these Exporters is in the <xref
linkend="ant"/>
- and <xref linkend="plugins"/> chapters.</para>
+ <para>
+ The tool provides a default set of Exporter's which can be used in both Ant and
the Eclipse UI. Documentation for these Exporters can be found in <xref
linkend="ant"/> and <xref linkend="plugins"/>.
+ </para>
- <para>Users can provide their own customer Exporter's, either by custom
classes implementing the
- Exporter interface or simply be providing custom templates. This is documented at
<xref
- linkend="hbmtemplate"/></para>
- </section>
+ <para>
+ Users can provide their own custom Exporter's, either through custom classes
implementing the <code>Exporter</code> interface or simply through custom
templates. This is documented at in <xref linkend="hbmtemplate"/>.
+ </para>
+ </section>
</chapter>
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/add_property1.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/add_property2.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/add_property3.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/add_property4.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/add_property5.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/annotations1.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/annotations1_a.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/annotations2.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/annotations3.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/dali_integration1.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/dali_integration10.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/dali_integration11.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/dali_integration2.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/dali_integration3.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/dali_integration4.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/dali_integration5.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/dali_integration7.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/dali_integration9.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/diagram1.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/diagram2.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/diagramToolbar.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/map_diagram1.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/map_diagram2.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/map_diagram3.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_0.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_0_a.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_0_b.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_1.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_12.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_12_a.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_12_b.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_13.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_14.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_15.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_16.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_17.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_17_a.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_18.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_18_a.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_18_b.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_18_g.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_19.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_19_b.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_19_c.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_19_d.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_2.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_20.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_21_a.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_21_b.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_22.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_2_a.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_3.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_4_a.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_4_b.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_4_c.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_4_d.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_5.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_6.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_7.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_8.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_8a.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_8b.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/plugins_9.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/prototypingQueries.png
===================================================================
(Binary files differ)
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/saveDiagram.png
===================================================================
(Binary files differ)
Modified: branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/introduction.xml
===================================================================
---
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/introduction.xml 2011-07-18
01:51:18 UTC (rev 32974)
+++
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/introduction.xml 2011-07-18
01:59:12 UTC (rev 32975)
@@ -1,163 +1,166 @@
<?xml version="1.0" encoding="UTF-8"?>
<chapter id="introduction">
- <title>Introduction</title>
+ <title>Introduction</title>
- <para><property>Hibernate Tools</property> is a toolset for
<ulink
-
url="http://www.hibernate.org/6.html">Hibernate 3</ulink>
and <ulink
-
url="http://www.hibernate.org/27.html">related
projects</ulink>. The tools provide Ant
+ <para>
+ <property>Hibernate Tools</property> is a collection of tools for <ulink
url="http://www.hibernate.org/">Hibernate 3</ulink> and related
projects. The tools provide Ant
tasks and Eclipse plugins for performing reverse engineering, code generation,
visualization
and interaction with Hibernate.</para>
- <section id="hibernate_key_features">
- <title>Key Features</title>
+ <section id="hibernate_key_features">
+ <title>Key Features</title>
- <para>First, we propose to look through the list of key features that you
can benefit from
- if you start using <property>Hibernate
Tools</property>.</para>
+ <para>The table below lists the key features found in <property>Hibernate
Tools</property>.</para>
- <table>
- <title>Key Functionality for Hibernate Tools</title>
- <tgroup cols="3">
-
- <colspec colnum="1" align="left"
colwidth="1*"/>
- <colspec colnum="2" colwidth="5*"/>
- <colspec colnum="3" align="left"
colwidth="1*"/>
-
- <thead>
- <row>
- <entry>Feature</entry>
- <entry>Benefit</entry>
- <entry>Chapter</entry>
- </row>
- </thead>
+ <table>
+ <title>Key Functionality for Hibernate Tools</title>
+ <tgroup cols="3">
- <tbody>
+ <colspec colnum="1" align="left" colwidth="1*"/>
+ <colspec colnum="2" colwidth="5*"/>
+ <colspec colnum="3" align="left" colwidth="1*"/>
- <row>
- <entry>
- <para>Code Generation through Ant Task</para>
- </entry>
- <entry>
- <para>Allows to execute mapping or Java code generation
from reverse
- engineering, schema generation and generation of other
artifacts
- during the build process.</para>
- </entry>
- <entry><xref linkend="ant"/></entry>
- </row>
+ <thead>
+ <row>
+ <entry>Feature</entry>
+ <entry>Benefit</entry>
+ <entry>Chapter</entry>
+ </row>
+ </thead>
- <row>
- <entry>
- <para>Wizards for creation
- purposes and code
- generation</para>
- </entry>
- <entry>
- <para> A set of wizards are provided with the Hibernate
Eclipse tools to
- quickly create common Hibernate files such as
configuration
- (cfg.xml) files, mapping files and revenge.xml as well.
Code
- Generation wizard helps to generate a series of various
artifacts,
- there is even support for completely reverse engineer an
existing
- database schema.</para>
- </entry>
- <entry> <xref linkend="map_file_wizard"/>
- <xref linkend="hib_config_file"/>
- <xref linkend="code_gen"/>
- </entry>
- </row>
+ <tbody>
+ <row>
+ <entry>
+ <para>Code Generation through Ant Task</para>
+ </entry>
+ <entry>
+ <para>
+ Allows to generate mapping or Java code through reverse engineering, schema
generation and generation of other artifacts during the build process.
+ </para>
+ </entry>
+ <entry>
+ <xref linkend="ant"/>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>
- Mapping and Configuration files
- Editors
- </para>
- </entry>
- <entry>
- <para>Support auto-completion and syntax highlighting.
Editors also
- support semantic auto-completion for class names and
property/field
- names, making it much more versatile than a normal XML
- editor.</para>
- </entry>
- <entry> <xref
linkend="map_config_editor"/></entry>
- </row>
+ <row>
+ <entry>
+ <para>Wizards for creation purposes and code generation</para>
+ </entry>
+ <entry>
+ <para>
+ A set of wizards are provided with the <productname>Hibernate Eclipse
Tools</productname> to quickly create common
<productname>Hibernate</productname> files such as configuration
(<filename>cfg.xml</filename>) files, mapping files and
<filename>reveng.xml</filename> as well. The Code Generation wizard helps by
generating a series of various artifacts, and there is even support for completely reverse
engineering an existing database schema.
+ </para>
+ </entry>
+ <entry>
+ <xref linkend="map_file_wizard"/>
+ <xref linkend="hib_config_file"/>
+ <xref linkend="code_gen"/>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>Tools for organizing and controlling Reverse
Engineering</para>
- </entry>
- <entry>
- <para>Code Generation wizard provides powerful
functionality for
- generating a series of various artifacts like domain
model classes,
- mapping files, annotated EJB3 entity beans, etc. and
reveng.xml file
- editor allows to control this processes.</para>
- </entry>
- <entry><xref linkend="code_gen"/>
- <xref
linkend="rev_xml_editor"/></entry>
- </row>
- <row>
- <entry>
- <para>Hibernate Console</para>
- </entry>
- <entry>
- <para>It is a new perspective in Eclipse which provides
an overview of
- your Hibernate Console configurations, were you also can
get an
- interactive view of your persistent classes and their
relationships.
- The console allows you to execute HQL queries against
your database
- and browse the result directly in Eclipse.</para>
- </entry>
- <entry><xref
linkend="hib_console"/></entry>
- </row>
+ <row>
+ <entry>
+ <para>Mapping and Configuration files Editors</para>
+ </entry>
+ <entry>
+ <para>
+ Support auto-completion and syntax highlighting. Editors also support semantic
auto-completion for class names and property/field names, making it much more versatile
than a normal XML editor.
+ </para>
+ </entry>
+ <entry>
+ <xref linkend="map_config_editor"/>
+ </entry>
+ </row>
+
+ <row>
+ <entry>
+ <para>Tools for organizing and controlling Reverse Engineering</para>
+ </entry>
+ <entry>
+ <para>
+ The Code Generation wizard provides powerful functionality for generating a
series of various artifacts such as domain model classes, mapping files, and annotated
EJB3 entity beans, and the <filename>reveng.xml</filename> file editor
provides control over this processes.
+ </para>
+ </entry>
+ <entry>
+ <xref linkend="code_gen"/>
+ <xref linkend="rev_xml_editor"/>
+ </entry>
+ </row>
+
+ <row>
+ <entry>
+ <para>Hibernate Console</para>
+ </entry>
+ <entry>
+ <para>
+ It is a new perspective in Eclipse which provides an overview of your Hibernate
Console configurations, and were you also can get an interactive view of your persistent
classes and their relationships. The console allows you to execute HQL queries against
your database and browse the result directly in Eclipse.
+ </para>
+ </entry>
+ <entry>
+ <xref linkend="hib_console"/>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>HQL Editor and Hibernate Criteria Editor</para>
- </entry>
- <entry>
- <para>The editors are intended for writing, editing and
executing HQL queries and criterias. They also support the functionality for generating
- simple queries.</para>
- </entry>
- <entry><xref
linkend="hql_and_criteria_editors"/></entry>
- </row>
+ <row>
+ <entry>
+ <para>HQL Editor and Hibernate Criteria Editor</para>
+ </entry>
+ <entry>
+ <para>
+ The editors are provided for writing, editing and executing HQL queries and
criterias. They also have the ability to generate simple queries.
+ </para>
+ </entry>
+ <entry>
+ <xref linkend="hql_and_criteria_editors"/>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>Functional Mapping Diagram</para>
- </entry>
- <entry>
- <para>Makes possible to visualize structure of entities
and
- relationships between them.</para>
- </entry>
- <entry><xref
linkend="map_diagram"/></entry>
- </row>
+ <row>
+ <entry>
+ <para>Functional Mapping Diagram</para>
+ </entry>
+ <entry>
+ <para>Makes possible to visualize the structure of entities and the
relationships between them.</para>
+ </entry>
+ <entry>
+ <xref linkend="map_diagram"/>
+ </entry>
+ </row>
- <row>
- <entry>
- <para>Eclipse JDT integration</para>
- </entry>
- <entry>
- <para>Hibernate Tools integrates into the Java code
completion and build
- support of Java in Eclipse. This gives you code
completion of HQL
- inside Java code. Additionally, Hibernate Tools will add
problem
- markers if your queries are not valid against the
console
- configuration associated with the project.</para>
- </entry>
- </row>
+ <row>
+ <entry>
+ <para>Eclipse JDT integration</para>
+ </entry>
+ <entry>
+ <para>
+ <productname>Hibernate Tools</productname> integrates into the Java
code completion and build support for Java in Eclipse. This gives you HQL code completion
inside Java code. Additionally, <productname>Hibernate Tools</productname>
will display problem markers if your queries are not valid against the console
configuration associated with the project.
+ </para>
+ </entry>
+ </row>
- </tbody>
- </tgroup>
- </table>
- </section>
-
- <section>
- <title>Other relevant resources on the topic</title>
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
+
+ <section>
+ <title>Other relevant resources on the topic</title>
- <!--para>Hibernate Tools page on the <ulink
url="http://www.hibernate.org/255.html">hibernate.org</ul...
- <para>All JBoss Developer Studio/JBoss Tools release documentation you can
find at<ulink
url="http://docs.jboss.org/tools/">http://docs.jboss.org/too...
in the corresponding release directory.</para>
- <para>There is some extra information about Hidernate on <ulink
url="http://www.jboss.org/community/wiki/JBossHibernate3">JBoss Wiki page.
</ulink></para>
- <para>The latest documentation builds are available at <ulink
url="http://download.jboss.org/jbosstools/nightly-docs/">htt...
- </section>
+ <para>The <productname>Hibernate Tools</productname> page on
<ulink
url="http://www.hibernate.org/subprojects/tools.html">hibern...
+ <para>
+ All <productname>JBDS</productname> release documentation can be found on
the <ulink
url="http://docs.redhat.com/docs/en-US/JBoss_Developer_Studio/index....
Documentation</ulink> website.
+ </para>
+ <para>
+ There is some additional information on
<productname>Hibernate</productname> on the <ulink
url="http://www.jboss.org/community/wiki/JBossHibernate3">JBoss
Wiki</ulink> page.
+ </para>
+ <para>
+ Nightly documentation builds are available <ulink
url="http://download.jboss.org/jbosstools/nightly-docs/">her...;.
+ </para>
+ </section>
</chapter>
Modified: branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/master.xml
===================================================================
--- branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/master.xml 2011-07-18
01:51:18 UTC (rev 32974)
+++ branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/master.xml 2011-07-18
01:59:12 UTC (rev 32975)
@@ -60,12 +60,12 @@
</imageobject>
</mediaobject>
-<abstract>
+<!--<abstract>
<title/>
<para>
<ulink
url="http://download.jboss.org/jbosstools/nightly-docs/en/hibernatet...
version</ulink>
</para>
-</abstract>
+</abstract>-->
</bookinfo>
<toc/>
Modified: branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/plugins.xml
===================================================================
--- branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/plugins.xml 2011-07-18
01:51:18 UTC (rev 32974)
+++ branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/plugins.xml 2011-07-18
01:59:12 UTC (rev 32975)
@@ -1,2674 +1,2373 @@
<?xml version="1.0" encoding="UTF-8"?>
<chapter id="plugins" role="updated">
- <title>Eclipse Plugins</title>
- <para>This chapter will introduce you to the functionality that
<property>Hibernate
- Tools</property> provide within Eclipse. That is a set of wizards and editors
for simplifying
- the work with <property>Hibernate</property>.</para>
- <section>
- <title>Introduction</title>
- <para>Hibernate Eclipse Tools include wizards for creating Hibernate mapping
files,
- configuration files (.cfg.xml), revenge.xml as well as wizards for adjusting
Console
- Configuration and Code Generation. Special structured and XML editors, editors for
executing
- HQL and Criteria queries are also provided in Hibernate Console. Refer to <xref
- linkend="hibernate_key_features"/> section to find all benefits that
you
- can take advantage of while using the tools within Eclipse.</para>
- <note>
- <title>Note:</title>
- <para>Please note that these tools do not try to hide any functionality of
<property
- >Hibernate</property>. The tools make working with
<property>Hibernate</property> easier,
- but you are still encouraged/required to read the <ulink
-
url="http://www.hibernate.org/5.html">Hibernate
Documentation</ulink> to fully utilize
- <property>Hibernate Tools</property> and especially
<property>Hibernate</property> it
- self.</para>
- </note>
- <section id="download_base_project">
- <title>Download base project</title>
- <para>You can download example projects which are used for this
chapter.</para>
- <para><property>JPA base project</property> is available on
<ulink
-
url="http://docs.jboss.org/tools/resources/">documentation
resources page </ulink>
- together with <ulink
-
url="http://docs.jboss.org/tools/resources/TestHibernateproject_for_...
- >base Java project</ulink>.</para>
- <para>Also you need start <ulink
url="http://docs.jboss.org/tools/resources/GSG_database.zip"
- >database</ulink>.</para>
- <note>
- <title>Note:</title>
- <para>How to run database you can know in <ulink
-
url="http://docs.jboss.org/tools/3.0.1.GA/en/GettingStartedGuide/htm...
- >Getting Started Guide</ulink>.</para>
- </note>
- </section>
- </section>
- <section id="map_file_wizard">
- <title>Creating a Hibernate Mapping File</title>
- <para>Hibernate mapping files are used to specify how your objects are related
to database
- tables.</para>
- <para>To create basic mappings for properties and associations, i. e. generate
<emphasis>
- <property>.hbm.xml</property>
- </emphasis> files, Hibernate Tools provide a basic wizard which you can bring
up by navigating
- <emphasis>
- <property>New > Hibernate XML mapping
file</property>.</emphasis></para>
- <para>At first you'll be asked to select a package or multiple
individual classes to map.
- It's also possible to create an empty file, don't select any packages
or classes and an
- empty .hbm will be created in the specified location</para>
- <para id="depth_control">With <property>depth
control</property> option you can define
- dependences depth for choosing classes (it means to set level of references which
is used to
- collect linked classes to the selection). </para>
- <figure>
- <title>Hibernate XML Mapping File Wizard</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/plugins_0.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>The next wizard page lists the mappings to be generated. As you see
<property
- >Customers</property>, <property>Orders</property>,
<property>Productlines</property> and
- <property>Products</property> classes added under
<property>depth control</property>
- driving. </para>
- <figure>
- <title>Mappings to be generated</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/plugins_0_a.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>This wizard page outputs a generated .hbm files preview.</para>
- <figure>
- <title>Preview Generated Mapping Files</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/plugins_0_b.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>Pressing <property>Finish</property> creates the
files.</para>
- </section>
- <section id="hib_config_file">
- <title>Creating a Hibernate Configuration File</title>
- <para>To be able to reverse engineer, prototype queries, and of course to
simply use <property
- >Hibernate Core</property> a <emphasis>
- <property>hibernate.properties</property>
- </emphasis> or <emphasis>
- <property>hibernate.cfg.xml</property>
- </emphasis> file is needed. The <property>Hibernate
Tools</property> provide a wizard for
- generating the <emphasis>
- <property>hibernate.cfg.xml</property>
- </emphasis> file if you do not already have such one.</para>
- <para>Start the wizard by clicking <emphasis>
- <property>New > Other (Ctrl+N)</property>
- </emphasis>, then <emphasis>
- <property>Hibernate > Hibernate Configuration File
(cfg.xml)</property>
- </emphasis> and press <emphasis>
- <property>Next</property>
- </emphasis> or on a web Seam project in the <property>Web
Projects</property> view <emphasis>
- <property> WebContent -> New -> File -> Hibernate Configuration
3.0</property>
- </emphasis>. After selecting the wanted location for the <emphasis>
- <property>hibernate.cfg.xml</property>
- </emphasis> file, you will see the following page:</para>
- <figure>
- <title>Hibernate Configuration File Wizard</title>
- <mediaobject>
- <imageobject role="fo">
- <imagedata align="center"
fileref="images/plugins/plugins_1.png" format="PNG"/>
- </imageobject>
- <imageobject role="html">
- <imagedata align="center"
fileref="images/plugins/plugins_1.png" format="PNG"/>
- </imageobject>
- </mediaobject>
- </figure>
- <note>
- <title>Note:</title>
- <para>The contents in the combo boxes for the JDBC driver class and JDBC URL
change
- automatically, depending on the Dialect and actual driver you have
chosen.</para>
- </note>
- <para>Enter your configuration information in this dialog. Details about the
configuration
- options can be found in <ulink
-
url="http://docs.jboss.org/ejb3/app-server/Hibernate3/reference/en/h...
- Reference Documentation</ulink>.</para>
- <para>Press <emphasis>
- <property>Finish</property>
- </emphasis> to create the configuration file, after optionally creating a
Console
- configuration, the <emphasis>
- <property>hibernate.cfg.xml</property>
- </emphasis> will be automatically opened in an editor. The last option
<emphasis>
- <property>Create Console Configuration</property>
- </emphasis> is enabled by default and when enabled, it will automatically use
the <emphasis>
- <property>hibernate.cfg.xml</property>
- </emphasis> for the basis of a Console configuration.</para>
- </section>
- <section id="console_conf">
- <title>Hibernate Console Configuration</title>
- <para>A Console configuration describes how the <property>Hibernate
plugin</property> should
- configure <property>Hibernate</property> and what configuration files,
including which
- classpath are needed to load the POJO's, JDBC drivers etc. It is required to
make usage of
- query prototyping, reverse engineering and code generation. You can have multiple
named
- console configurations. Normally you would just need one per project, but more is
definitely
- possible if your project requires this.</para>
- <section id="creat_console_conf">
- <title>Creating a Hibernate Console Configuration</title>
- <para>You can create a console configuration by running the
<property>Console Configuration
- Wizard</property>, shown in the following screenshot. The same wizard
will also be used if
- you are coming from the <emphasis>
- <property>hibernate.cfg.xml</property>
- </emphasis> wizard and had enabled <emphasis>
- <property>Create Console Configuration</property>
- </emphasis>.</para>
- <note>
- <title>Note:</title>
- <para>The wizard will look at the current selection in the IDE and try and
auto-detect the
- settings which you then can just approve or modify to suit your
needs.</para>
- </note>
- <para/>
- <para>The dialog consists of five tabs: </para>
- <itemizedlist>
- <listitem>
- <para><emphasis>
- <property>Main</property>
- </emphasis> for the basic/required settings</para>
- </listitem>
- </itemizedlist>
- <figure>
- <title> Creating Hibernate Console Configuration</title>
- <mediaobject>
- <imageobject role="fo">
- <imagedata align="center"
fileref="images/plugins/plugins_2.png" format="PNG"/>
- </imageobject>
- <imageobject role="html">
- <imagedata align="center"
fileref="images/plugins/plugins_2.png" format="PNG"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>The following table describes the available settings on the
<emphasis>
- <property>Main</property>
- </emphasis> tab. The wizard can automatically detect the default values for
most of them if
- you started the wizard with the relevant java project or resource
selected.</para>
- <table>
- <title>Hibernate Console Configuration Parameters</title>
- <tgroup cols="3">
- <colspec colnum="1" align="left"
colwidth="1*"/>
- <colspec colnum="2" colwidth="3*"/>
- <colspec colnum="3" align="left"
colwidth="1*"/>
- <thead>
- <row>
- <entry align="center">
- <para>Parameter</para>
- </entry>
- <entry align="center">
- <para>Description</para>
- </entry>
- <entry align="center">
- <para>Auto detected value</para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>Name</para>
- </entry>
- <entry>
- <para>The unique name of the console configuration</para>
- </entry>
- <entry>
- <para>Name of the selected project</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Type</para>
- </entry>
- <entry>
- <para>Choose between "Core",
"Annotations" and "JPA".
- Note that the two latter requires running Eclipse IDE with a JDK 5
runtime,
- otherwise you will get classloading and/or version
errors.</para>
- </entry>
- <entry>
- <para>No default value</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Project</para>
- </entry>
- <entry>
- <para>The name of a java project which classpath should be used in
the console
- configuration</para>
- </entry>
- <entry>
- <para>Name of the selected project</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Database connection</para>
- </entry>
- <entry>
- <para>DTP provided connection that you can use instead of what is
in cfg.xml and jpa
- persistence.xml. It's possible to use either already
configured hibernate or
- JPA connection or specify a new one here.</para>
- </entry>
- <entry>
- <para>[Hibernate Configured connection]</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Property file</para>
- </entry>
- <entry>
- <para>Path to a hibernate.properties file</para>
- </entry>
- <entry>
- <para>First hibernate.properties file found in the selected
project</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Configuration file</para>
- </entry>
- <entry>
- <para>Path to a hibernate.cfg.xml file</para>
- </entry>
- <entry>
- <para>First hibernate.cfg.xml file found in the selected
project</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Persistence unit</para>
- </entry>
- <entry>
- <para>Name of the persistence unit to use</para>
- </entry>
- <entry>
- <para>No default value (let Hibernate Entity Manager find the
persistence unit or it
- can be defined manually using Browse button)</para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <note>
- <title>Tip:</title>
- <para>The two latter settings are usually not required if you specify a
project and it has
- <emphasis>
- <property>
- <literal> /hibernate.cfg.xml </literal>
- </property>
- </emphasis> or <emphasis>
- <property>
- <literal>/META-INF/persistence.xml</literal>
- </property>
- </emphasis> in its project classpath.</para>
- </note>
- <itemizedlist>
- <listitem>
- <para>
- <emphasis>
- <property>Options</property>
- </emphasis> for the additional/optional settings</para>
- </listitem>
- </itemizedlist>
- <figure>
- <title>Options Tab of the Console Configuration Wizard</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/plugins_2_a.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>The next table describes Hibernate Console Configuration options
available on the
- <emphasis>
- <property>Options</property>
- </emphasis> tab.</para>
- <table>
- <title>Hibernate Console Configuration Options</title>
- <tgroup cols="3">
- <colspec colnum="1" align="left"
colwidth="1*"/>
- <colspec colnum="2" colwidth="3*"/>
- <colspec colnum="3" align="left"
colwidth="1*"/>
- <thead>
- <row>
- <entry align="center">
- <para>Parameter</para>
- </entry>
- <entry align="center">
- <para>Description</para>
- </entry>
- <entry align="center">
- <para>Auto detected value</para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>Database dialect</para>
- </entry>
- <entry>
- <para>Define a database dialect. It's possible either to
write your value or
- choose from list. </para>
- </entry>
- <entry>
- <para>No default value</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Naming strategy</para>
- </entry>
- <entry>
- <para>Fully qualified classname of a custom NamingStrategy. Only
required if you use
- a special naming strategy.</para>
- </entry>
- <entry>
- <para>No default value</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Entity resolver</para>
- </entry>
- <entry>
- <para>Fully qualified classname of a custom EntityResolver. Only
required if you
- have special xml entity includes in your mapping files.</para>
- </entry>
- <entry>
- <para>No default value</para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <itemizedlist>
- <listitem>
- <para><emphasis>
- <property>Classpath</property>
- </emphasis> for classpath</para>
- </listitem>
- </itemizedlist>
- <figure>
- <title>Specifying Classpath in Hibernate Console
Configuration</title>
- <mediaobject>
- <imageobject role="fo">
- <imagedata align="center"
fileref="images/plugins/plugins_3.png" format="PNG"/>
- </imageobject>
- <imageobject role="html">
- <imagedata align="center"
fileref="images/plugins/plugins_3.png" format="PNG"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>The following table specifies the parameters of the Classpath tab of
the wizard.</para>
- <table>
- <title>Hibernate Console Configuration Classpath</title>
- <tgroup cols="3">
- <colspec colnum="1" align="left"
colwidth="1*"/>
- <colspec colnum="2" colwidth="3*"/>
- <colspec colnum="3" colwidth="1*"/>
- <thead>
- <row>
- <entry align="center">
- <para>Parameter</para>
- </entry>
- <entry align="center">
- <para>Description</para>
- </entry>
- <entry align="center">
- <para>Auto detected value</para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>Classpath</para>
- </entry>
- <entry>
- <para>The classpath for loading POJO and JDBC drivers; only needed
if the default
- classpath of the Project does not contain the required classes. Do not
add
- Hibernate core libraries or dependencies, they are already included. If
you get
- ClassNotFound errors then check this list for possible missing or
redundant
- directories/jars.</para>
- </entry>
- <entry>
- <para>Empty</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Include default classpath from project</para>
- </entry>
- <entry>
- <para>When enabled the project classpath will be appended to the
classpath specified
- above</para>
- </entry>
- <entry>
- <para>Enabled</para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <itemizedlist>
- <listitem>
- <para><emphasis>
- <property>Mappings</property>
- </emphasis> for additional mappings</para>
- </listitem>
- </itemizedlist>
- <figure>
- <title>Specifying additional Mappings in Hibernate Console
Configuration</title>
- <mediaobject>
- <imageobject role="fo">
- <imagedata align="center"
fileref="images/plugins/plugins_4.png" format="PNG"/>
- </imageobject>
- <imageobject role="html">
- <imagedata align="center"
fileref="images/plugins/plugins_4.png" format="PNG"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>Parameters of the Mappings tab of the <property>Hibernate Console
Configuration
- wizard</property> are explained below:</para>
- <table>
- <title>Hibernate Console Configuration Mappings</title>
- <tgroup cols="3">
- <colspec colnum="1" align="left"
colwidth="1*"/>
- <colspec colnum="2" colwidth="3*"/>
- <colspec colnum="3" colwidth="1*"/>
- <thead>
- <row>
- <entry align="center">
- <para>Parameter</para>
- </entry>
- <entry align="center">
- <para>Description</para>
- </entry>
- <entry align="center">
- <para>Auto detected value</para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>Mapping files </para>
- </entry>
- <entry>
- <para>List of additional mapping files that should be loaded. Note:
A
- hibernate.cfg.xml or persistence.xml can also contain mappings. Thus if
these are
- duplications here, you will get "Duplicate mapping" errors
when using the console
- configuration.</para>
- </entry>
- <entry>
- <para>empty</para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <itemizedlist>
- <listitem>
- <para>and the last tab <emphasis>
- <property>Common</property>
- </emphasis></para>
- </listitem>
- </itemizedlist>
- <figure>
- <title>Common Tab of the Console Configuration Wizard</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/plugins_4_a.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>It allows to define general aspects of the launch configuration
including storage
- location, console encoding and some others.</para>
- <para>Clicking <emphasis>
- <property>Finish</property>
- </emphasis> creates the configuration and shows it in the
<property>Hibernate Configurations
- view</property>.</para>
- <figure>
- <title>Console Overview</title>
- <mediaobject>
- <imageobject role="fo">
- <imagedata align="center"
fileref="images/plugins/plugins_5.png" format="PNG"/>
- </imageobject>
- <imageobject role="html">
- <imagedata align="center"
fileref="images/plugins/plugins_5.png" format="PNG"/>
- </imageobject>
- </mediaobject>
- </figure>
- </section>
- <section id="modif_console_conf">
- <title>Modifying a Hibernate Console Configuration </title>
- <para>When you created a hibernate console configuration you can modify it in
2 ways: </para>
- <itemizedlist>
- <listitem>
- <para>right-click on the configuration in <emphasis>
- <property>Hibernate Configurations View->Edit Configuration
</property>
- </emphasis> or just double-click on <property>Console
Configuration</property>
- item.</para>
- <figure>
- <title>Opening Edit Configuration Wizard</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/plugins_4_c.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para> After clicking you will see the Edit Configuration Wizard that is
similar to
- <emphasis>
- <property>Create Console Configuration</property>
- </emphasis>,described in <xref
linkend="creat_console_conf"/>. </para>
- </listitem>
- <listitem>
- <para>use Properties view for modifying some of Console Configuration
properties.</para>
- <figure>
- <title>Properties View</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/plugins_4_b.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>The following table describes the available settings in the
Properties view. Most
- properties are changeable by left click but some are not. <table>
- <title>Properties</title>
- <tgroup cols="3">
- <colspec colnum="1" align="left"
colwidth="1*"/>
- <colspec colnum="2" colwidth="3*"/>
- <colspec colnum="3" align="left"
colwidth="1*"/>
- <thead>
- <row>
- <entry align="center">
- <para>Property</para>
- </entry>
- <entry align="center">
- <para>Description</para>
- </entry>
- <entry align="center">
- <para>Is Changeable</para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>Additional mapping files </para>
- </entry>
- <entry>
- <para>List of additional mapping files that should be loaded.
</para>
- </entry>
- <entry>
- <para>False</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Configuration file</para>
- </entry>
- <entry>
- <para>Path to a hibernate.cfg.xml file</para>
- </entry>
- <entry>
- <para>False</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Connection</para>
- </entry>
- <entry>
- <para>DTP provided connection that you can use instead of
what is in cfg.xml
- and jpa persistence.xml. It's possible to use either
already configured
- hibernate or JPA connection or specify a new one
here.</para>
- </entry>
- <entry>
- <para>True</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Name</para>
- </entry>
- <entry>
- <para>The unique name of the console
configuration</para>
- </entry>
- <entry>
- <para>True</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Project</para>
- </entry>
- <entry>
- <para>The name of a java project which classpath should be
used in the console
- configuration</para>
- </entry>
- <entry>
- <para>True</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Properties file</para>
- </entry>
- <entry>
- <para>Path to a hibernate.properties file</para>
- </entry>
- <entry>
- <para>False</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Type</para>
- </entry>
- <entry>
- <para>Choose between "CORE",
"ANNOTATIONS" and
- "JPA" according to the method of relational
mapping you want to
- use. Note, the two latter requires running Eclipse IDE with a JDK
5 runtime,
- otherwise you will get classloading and/or version
errors.</para>
- </entry>
- <entry>
- <para>True</para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table></para>
- </listitem>
- </itemizedlist>
- </section>
- <section id="closing_conf_config">
- <title>Closing Hibernate Console Configuration</title>
- <para>To close <property>Hibernate Console
Configuration</property> you need do right-click
- your configuration and choose <property>Close
Configuration</property> option </para>
- <figure>
- <title>Close Hibernate Console Configuration</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/plugins_4_d.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>While closing configuration the connection with database will be
closed, jar libs will
- be unlock (for Windows) and other resources will set as free. </para>
- </section>
- </section>
- <section id="refeng_codegen" role="updated">
- <title>Reverse Engineering and Code Generation</title>
- <para>A "click-and-generate" reverse engineering and code
generation facility is
- available. This facility allows you to generate a range of artifacts based on
database or an
- already existing Hibernate configuration, be that mapping files or annotated
classes. Some of
- these are POJO Java source file, Hibernate <emphasis>
- <property>.hbm.xml</property>
- </emphasis>, <emphasis>
- <property>hibernate.cfg.xml</property>
- </emphasis> generation and schema documentation.</para>
- <para>To start working with this process, start the <property>Hibernate
Code
- Generation</property> which is available in the toolbar via the
<property
- >Hibernate</property> icon or via the <emphasis>
- <property>Run > Hibernate Code Generation</property>
- </emphasis> menu item.</para>
- <section id="code_gen">
- <title>Code Generation Launcher</title>
- <para>When you click on <emphasis>
- <property>Open Hibernate Code Generation Dialog...</property>
- </emphasis> the standard Eclipse launcher dialog will appear. In this
dialog you can create,
- edit and delete named Hibernate code generation
"launchers".</para>
- <figure id="hib_code_gen">
- <title>Getting Hibernate Code Generation Wizard</title>
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/plugins/plugins_6.png"
format="PNG"/>
- </imageobject>
- <imageobject role="html">
- <imagedata align="center"
fileref="images/plugins/plugins_6.png" format="PNG"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para/>
- <figure>
- <title>Hibernate Code Generation Wizard</title>
- <mediaobject>
- <imageobject role="fo">
- <imagedata align="center" scale="80"
fileref="images/plugins/plugins_7.png" format="PNG"
- />
- </imageobject>
- <imageobject role="html">
- <imagedata align="center"
fileref="images/plugins/plugins_7.png" format="PNG"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>The first time you create a code generation launcher you should give it
a meaningful
- name, otherwise the default prefix <emphasis>
- <property>New_Generation</property>
- </emphasis> will be used.</para>
- <note>
- <title>Tip:</title>
- <para>The "At least one exporter option must be selected"
is just a warning
- stating that for this launch to work you need to select an exporter on the
Exporter tab.
- When an exporter has been selected the warning will disappear.</para>
- </note>
- <para>The dialog also have the standard tabs <emphasis>
- <property>Refresh</property>
- </emphasis> and <emphasis>
- <property>Common</property>
- </emphasis> that can be used to configure which directories should be
automatically
- refreshed and various general settings launchers, such as saving them in a
project for
- sharing the launcher within a team.</para>
- <para>On the <emphasis>
- <property>Main</property>
- </emphasis> tab you see the following fields:</para>
- <table>
- <title>Code generation "Main" tab fields</title>
- <tgroup cols="2">
- <colspec colnum="1" align="left"
colwidth="1*"/>
- <colspec colnum="2" colwidth="3*"/>
- <colspec colnum="3" colwidth="0.5*"/>
- <thead>
- <row>
- <entry align="center">
- <para>Field</para>
- </entry>
- <entry align="center">
- <para>Description</para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>Console Configuration</para>
- </entry>
- <entry>
- <para>The name of the console configuration which should be used
when code
- generating</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Output directory</para>
- </entry>
- <entry>
- <para>Path to a directory where all output will be written by
default. It's possible
- to enter absolute directory path, for example - "d:/temp". Be
aware that existing
- files will be overwritten, so be sure to specify the correct
directory.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Reverse engineer from JDBC Connection</para>
- </entry>
- <entry>
- <para>If enabled, the tools will reverse engineer the database
available via the
- connection information in the selected Hibernate Console Configuration
and
- generate code based on the database schema. If not enabled, the code
generation
- will just be based on the mappings already specified in the Hibernate
Console
- configuration.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Package</para>
- </entry>
- <entry>
- <para>The package name here is used as the default package name for
any entities
- found when reverse engineering</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>reveng.xml</para>
- </entry>
- <entry>
- <para>Path to a reveng.xml file. A reveng.xml file allows you to
control certain
- aspects of the reverse engineering. e.g. how jdbc types are mapped to
hibernate
- types and especially important which tables are included/excluded from
the
- process. Clicking "setup" allows you to select an existing
reveng.xml file or
- create a new one. See more details about the reveng.xml file in
<xref
- linkend="reverseengineering"/>.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>reveng. strategy</para>
- </entry>
- <entry>
- <para>If reveng.xml does not provide enough customization you can
provide your own
- implementation of an ReverseEngineeringStrategy. The class needs to be
in the
- classpath of the Console Configuration, otherwise you will get class
not found
- exceptions. See <xref
linkend="custom-reveng-strategy"/> for details and an
- example of a custom strategy.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Generate basic typed composite ids</para>
- </entry>
- <entry>
- <para>A table that has a multi-column primary key a
<composite-id> mapping
- will always be created. If this option is enabled and there are
matching
- foreign-keys each key column is still considered a 'basic'
scalar (string, long,
- etc.) instead of a reference to an entity. If you disable this option
a
- <code><key-many-to-one></code> instead.
Note: a
- <code><many-to-one></code> property is
still created, but is simply marked
- as non-updatable and non-insertable.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Detect optimistic lock columns</para>
- </entry>
- <entry>
- <para>Automatically detect optimistic lock columns. Controllable
via reveng.
- strategy; the current default is to use columns named VERSION or
TIMESTAMP.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Detect many-to-many tables</para>
- </entry>
- <entry>
- <para>Automatically detect many-to-many tables. Controllable via
reveng.
- strategy.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Detect one-to-one associations</para>
- </entry>
- <entry>
- <para> Reverse engineering detects one-to-one associations via
primary key and both
- hbm.xml and annotation generation generates the proper code for it.
</para>
- <para> The detection is enabled by default (except for Seam 1.2 and
Seam 2.0)
- reverse engineering. For Hibernate Tools generation there is a checkbox
to disable
- if not wanted. </para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Use custom templates</para>
- </entry>
- <entry>
- <para>If enabled, the Template directory will be searched first
when looking up the
- templates, allowing you to redefine how the individual templates
process the
- hibernate mapping model.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Template directory</para>
- </entry>
- <entry>
- <para>A path to a directory with custom templates</para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </section>
- <section id="exportes">
- <title>Exporters</title>
- <para>The <emphasis>
- <property>Exporters</property>
- </emphasis> tab is used to specify which type of code that should be
generated. Each
- selection represents an Exporter that is responsible for generating the code,
hence the
- name.</para>
- <figure>
- <title>Selecting Exporters</title>
- <mediaobject>
- <imageobject role="fo">
- <imagedata align="center" scale="80"
fileref="images/plugins/plugins_8.png" format="PNG"
- />
- </imageobject>
- <imageobject role="html">
- <imagedata align="center"
fileref="images/plugins/plugins_8.png" format="PNG"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>The following table describes in short the various exporters. Remember
you can
- add/remove any Exporters depending on your needs.</para>
- <table>
- <title>Code generation "Exporter" tab fields</title>
- <tgroup cols="2">
- <colspec colnum="1" align="left"
colwidth="1*"/>
- <colspec colnum="2" colwidth="3*"/>
- <thead>
- <row>
- <entry align="center">
- <para>Field</para>
- </entry>
- <entry align="center">
- <para>Description</para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>Domain code</para>
- </entry>
- <entry>
- <para>Generates POJO's for all the persistent classes and
components found in the
- given Hibernate configuration.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>DAO code</para>
- </entry>
- <entry>
- <para>Generates a set of DAO's for each entity
found.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Hibernate XML Mappings</para>
- </entry>
- <entry>
- <para>Generate mapping (hbm.xml) files for each
entity.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Hibernate XML Configuration</para>
- </entry>
- <entry>
- <para>Generate a hibernate.cfg.xml file. Used to keep the
hibernate.cfg.xml update
- with any new found mapping files.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Schema Documentation (.html)</para>
- </entry>
- <entry>
- <para>Generates a set of html pages that documents the database
schema and some of
- the mappings.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Generic Exporter (hbmtemplate)</para>
- </entry>
- <entry>
- <para>Fully customizable exporter which can be used to perform
custom
- generation.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Schema Export (.ddl)</para>
- </entry>
- <entry>
- <para>Generates the appropriate SQL DDL and allows you to store the
result in a file
- or export it directly to the database.</para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <para>Each Exporter listens to certain properties and these can be setup in
the <emphasis>
- <property>Properties</property>
- </emphasis> section where you can add/remove predefined or customer
properties for each of
- the exporters. The following table lists the time of writing predefined
properties:</para>
- <para>
- <table>
- <title>Exporter Properties</title>
- <tgroup cols="2">
- <colspec colnum="1" align="left"
colwidth="1*"/>
- <colspec colnum="2" colwidth="3*"/>
- <thead>
- <row>
- <entry align="center">
- <para>Name</para>
- </entry>
- <entry align="center">
- <para>Description</para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>jdk5</para>
- </entry>
- <entry>
- <para>Generate Java 5 syntax</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>ejb3</para>
- </entry>
- <entry>
- <para>Generate EJB 3 annotations</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>for_each</para>
- </entry>
- <entry>
- <para>Specifies for which type of model elements the exporter
should create a file
- and run through the templates. Possible values are: entity,
component,
- configuration</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>template_path</para>
- </entry>
- <entry>
- <para>Custom template directory for this specific exporter. You
can use Eclipse
- variables.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>template_name</para>
- </entry>
- <entry>
- <para>Name for template relative to the template
path</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>outputdir</para>
- </entry>
- <entry>
- <para>Custom output directory for this specific exporter. You can
use Eclipse
- variables.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>file_pattern</para>
- </entry>
- <entry>
- <para>Pattern to use for the generated files, relatively for the
output dir.
- Example: {package-name}/{class-name}.java .</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>dot.executable</para>
- </entry>
- <entry>
- <para>Executable to run GraphViz (only relevant, but optional for
Schema
- documentation)</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>drop</para>
- </entry>
- <entry>
- <para>Output will contain drop statements for the tables, indices
and
- constraints</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>delimiter</para>
- </entry>
- <entry>
- <para>If specified the statements will be dumped to this
file</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>create</para>
- </entry>
- <entry>
- <para>Output will contain create statements for the tables,
indices and
- constraints</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>scriptToConsole</para>
- </entry>
- <entry>
- <para>The script will be output to Console</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>exportToDatabase</para>
- </entry>
- <entry>
- <para>Executes the generated statements against the
database</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>outputFileName</para>
- </entry>
- <entry>
- <para>If specified the statements will be dumped to this
file</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>haltOnError</para>
- </entry>
- <entry>
- <para>Halts the build process if an error occurs</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>format</para>
- </entry>
- <entry>
- <para>Applies basic formatting to the statements</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>schemaUpdate</para>
- </entry>
- <entry>
- <para>Updates a schema</para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
+ <title>Eclipse Plugins</title>
+ <para>
+ This chapter will introduce you to the set of wizards and editors provided by
<productname>Hibernate Tools</productname> within Eclipse, which are designed
to simplify working with <productname>Hibernate</productname>.
+ </para>
+ <section>
+ <title>Introduction</title>
+ <para>
+ Hibernate Eclipse Tools includes wizards for creating Hibernate mapping files,
configuration files (<filename>.cfg.xml</filename>),
<filename>reveng.xml</filename> files as well as wizards for adjusting Console
Configuration and Code Generation. Special structured and XML editors and editors for
executing HQL and Criteria queries are also provided in Hibernate Console. Refer to
<xref linkend="hibernate_key_features"/> to find all the benefits that are
provided by these tools within Eclipse.
+ </para>
+ <note>
+ <title>Note:</title>
+ <para>
+ Please note that these tools do not try to hide any of
<productname>Hibernates</productname> functionality; rather the tools make
working with <productname>Hibernate</productname> easier. You are still
encouraged to read the <ulink
url="http://hibernate.org/docs">Hibernate
Documentation</ulink> in order to be able to fully utilize
<productname>Hibernate Tools</productname> and especially
<productname>Hibernate</productname> itself.
+ </para>
+ </note>
+ <section id="download_base_project">
+ <title>Download base project</title>
+ <para>You can download the example projects that are used in this
chapter.</para>
+ <para>
+ A <property>JPA base project</property> is available on the <ulink
url="http://docs.jboss.org/tools/resources/">documentation resources
page</ulink> together with a <ulink
url="http://docs.jboss.org/tools/resources/TestHibernateproject_for_...
Java project</ulink>.
</para>
- <para>To add a property to the chosen Exporter click the <emphasis>
- <property>Add</property>
- </emphasis> button in the <property>Properties</property>
section. In the appeared dialog
- you should select the property from the proposed list and the value for
it.</para>
- <figure>
- <title>Adding the Property for Schema Export (.ddl)</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/plugins_8a.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <note>
- <title>Tip:</title>
- <para>If the property is a directory, it is possible to browse directories
in the Value
- field.</para>
- </note>
- <figure>
- <title>Specifying the Property Value</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/plugins_8b.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- </section>
- </section>
- <section id="map_config_editor">
- <title>Hibernate Mapping and Configuration File Editor</title>
- <para>The <property>Hibernate Mapping File editor</property>
provides XML editing functionality
- for the <emphasis>
- <property>hbm.xml </property>
- </emphasis> and <emphasis>
- <property>cfg.xml</property>
- </emphasis> files. The editor is based on the Eclipse WTP tools and extends
its functionality
- to provide Hibernate specific code completion.</para>
- <figure>
- <title>XML Editing Functionality</title>
- <mediaobject>
- <imageobject role="fo">
- <imagedata align="center" scale="80"
fileref="images/plugins/plugins_9.png" format="PNG"/>
- </imageobject>
- <imageobject role="html">
- <imagedata align="center"
fileref="images/plugins/plugins_9.png" format="PNG"/>
- </imageobject>
- </mediaobject>
- </figure>
- <section>
- <title>Java property/class completion</title>
- <para>Package, class, and field completion is enabled for relevant XML
attributes. The
- auto-completion detects its context and limits the completion for e.g.
- <code><property></code> and only shows the
properties/fields available in the
- enclosing <code><class></code> ,
<code><subclass></code> etc. It is also
- possible to navigate from the <emphasis>
- <property>hbm.xml</property>
- </emphasis> files to the relevant class/field in java code.</para>
- <figure>
- <title>Navigation Functionality</title>
- <mediaobject>
- <imageobject role="fo">
- <imagedata align="center"
fileref="images/plugins/plugins_10.png" format="PNG"
- scale="80"/>
- </imageobject>
- <imageobject role="html">
- <imagedata align="center"
fileref="images/plugins/plugins_10.png" format="PNG"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>This is done via the standard hyperlink navigation functionality in
Eclipse; per default
- it is done by pressing F3 while the cursor is on a class/field or by pressing
<emphasis>
- <property>Ctrl</property>
- </emphasis> and the mouse button to perform the same
navigation.</para>
- <para>For java completion and navigation to work the file needs to reside
inside an Eclipse
- Java project, otherwise no completion will occur.</para>
- <note>
- <title>Note:</title>
- <para>Java completion does not require a Hibernate console configuration to
be used.</para>
- </note>
- </section>
- <section>
- <title>Table/Column completion</title>
- <para>Table and column completion is also available for all table and column
attributes. </para>
- <figure>
- <title>Table and Column Completion</title>
- <mediaobject>
- <imageobject role="fo">
- <imagedata align="center" scale="80"
fileref="images/plugins/plugins_11.png"
- format="PNG"/>
- </imageobject>
- <imageobject role="html">
- <imagedata align="center"
fileref="images/plugins/plugins_11.png" format="PNG"/>
- </imageobject>
- </mediaobject>
- </figure>
- <important>
- <title>Important:</title>
- <para>Table/Column completion requires a proper configured hibernate
console configuration
- and this configuration should be the default for the project where the
<emphasis>
- <property>hbm.xml</property>
- </emphasis> resides.</para>
- </important>
- <para>You can check which console configuration is selected under the
Properties of a project
- and look under the <emphasis>
- <property>Hibernate Settings</property>
- </emphasis> page. When a proper configuration is selected it will be used
to fetch the
- table/column names in the background.</para>
- <note>
- <title>Note:</title>
- <para>Currently it is not recommended to use this feature on large
databases since it does
- not fetch the information iteratively. It will be improved in future
versions.</para>
- </note>
- </section>
- <section>
- <title>Configuration property completion</title>
- <para>In <emphasis>
- <property>cfg.xml</property>
- </emphasis> code completion for the value of
<code><property> name</code> attributes
- is available.</para>
- <figure>
- <title>Property Completion</title>
- <mediaobject>
- <imageobject role="fo">
- <imagedata align="center" scale="80"
fileref="images/plugins/plugins_12.png"
- format="PNG"/>
- </imageobject>
- <imageobject role="html">
- <imagedata align="center"
fileref="images/plugins/plugins_12.png" format="PNG"/>
- </imageobject>
- </mediaobject>
- </figure>
- </section>
- </section>
- <section id="map_config_struct_editor">
- <title>Structured Hibernate Mapping and Configuration File
Editor</title>
- <para>The structured editor represents the file in the tree form. It also
allows to modify the
- structure of the file and its elements with the help of tables provided on the
right-hand
- area.</para>
- <para>To open any mapping file in the editor, choose <emphasis>
- <property>Open With > Hibernate 3.0 XML Editor</property>
- </emphasis> option from the context menu of the file. The editor should look
as
- follows:</para>
- <figure>
- <title>Structured hbm.xml Editor</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/plugins_12_a.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>For the configuration file you should choose <emphasis>
- <property>Open With > Hibernate Configuration 3.0 XML
Editor</property>
- </emphasis>option.</para>
- <figure>
- <title>Structured cfg.xml Editor</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/plugins_12_b.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- </section>
- <section id="properties_editor">
- <title>JBoss Tools Properties Editor</title>
- <para>The editor is meant for editing
<literal>.properties</literal> files. It contains two
- tabs: the <property>Properties</property> (UI) tab and the
<property>Source</property> tab for
- manual editing.</para>
- <para>For <literal>hibernate.properties</literal> file
<property>JBoss Tools Properties
- Editor</property> provides content assist which is available both for
hibernate properties
- and property values. You can make use of the content assist while editing the file
in the
- Source view and in the Properties view of the editor.</para>
- <para>To add the property in the <property>Properties</property>
view, click the <emphasis>
- <property>Add</property>
- </emphasis> button.</para>
- <figure>
- <title>Adding the Property</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/add_property1.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>In the <emphasis>
- <property>Name</property>
- </emphasis> field press <emphasis>
- <property>Ctrl+Space</property>
- </emphasis> to invoke the content assist. It will suggest <emphasis>
- <property>'hibernate.'</property>
- </emphasis> which is the prefix for all hibernate properties. After selecting
<emphasis>
- <property>'hibernate.'</property>
- </emphasis> and invoking the content assist again, other prefixes and
properties are displayed
- as the proposals with a description of each one.</para>
- <figure>
- <title>Content Assist for Properties Names</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/add_property2.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>When invoking the content assist in the <emphasis>
- <property>Value</property>
- </emphasis> field, it also provides a list of proposals.</para>
- <figure>
- <title>Content Assist for Properties Values</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/add_property3.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>In the <property>Source</property> view of the editor,
content assist also could be
- invoked both for properties names and values:</para>
- <figure>
- <title>Content Assist in the Source view</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/add_property4.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <figure>
- <title>Content Assist in the Source view</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/add_property5.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- </section>
- <section id="rev_xml_editor">
- <title>Reveng.xml Editor</title>
- <para>A <emphasis>
- <property>reveng.xml </property>
- </emphasis> file is used to customize and control how reverse engineering is
performed by the
- tools. The plugins provide an editor to ease the editing of this file and hence
used to
- configure the reverse engineering process.</para>
- <para>The editor is intended to allow easy definition of type mappings, table
include/excludes
- and specific override settings for columns, e.g. define an explicit name for a
column when the
- default naming rules are not applicable.</para>
- <note>
- <title>Note:</title>
- <para> Not all the features of the <emphasis>
- <property>.reveng.xml </property>
- </emphasis> file are exposed or fully implemented in the editor, but the
main functionality
- is there. To understand the full flexibility of the <emphasis>
- <property>reveng.xml</property>
- </emphasis>, please see <xref
linkend="hibernaterevengxmlfile"/>
- </para>
- </note>
- <para>The editor is activated as soon as an <emphasis>
- <property>.reveng.xml </property>
- </emphasis> file is opened. To get an initial <emphasis>
- <property>reveng.xml </property>
- </emphasis> file the <property>Reverse Engineering File
Wizard</property> can be started via
- <emphasis>
- <property>Ctrl+N</property>
- </emphasis> and <emphasis>
- <property>Hibernate > Hibernate Reverse Engineering File
(reveng.xml)</property>
- </emphasis> then.</para>
- <figure>
- <title>ChooseReverse Engineering File Wizard </title>
- <mediaobject>
- <imageobject role="fo">
- <imagedata align="center" scale="80"
fileref="images/plugins/plugins_22.png" format="PNG"
- />
- </imageobject>
- <imageobject role="html">
- <imagedata align="center"
fileref="images/plugins/plugins_22.png" format="PNG"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>Or you can get it via the <property>Code Generation
Launcher</property> by checking the
- proper section in the <emphasis>
- <property>Main</property>
- </emphasis> tab of the <xref
linkend="hib_code_gen"/>.</para>
- <para>The following screenshot shows the <emphasis>
- <property>Overview</property>
- </emphasis> page where the wanted console configuration is selected
(auto-detected if
- Hibernate 3 support is enabled for the project)</para>
- <figure>
- <title>Overview Page</title>
- <mediaobject>
- <imageobject role="fo">
- <imagedata align="center" scale="80"
fileref="images/plugins/plugins_13.png" format="PNG"
- />
- </imageobject>
- <imageobject role="html">
- <imagedata align="center"
fileref="images/plugins/plugins_13.png" format="PNG"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>The <emphasis>
- <property>Table Filter</property>
- </emphasis> page allows you to specify which tables to include and exclude.
Pressing
- <emphasis>
- <property>Refresh</property>
- </emphasis> shows the tables from the database that have not yet been
excluded.</para>
- <figure>
- <title>Table Filters Page</title>
- <mediaobject>
- <imageobject role="fo">
- <imagedata align="center" scale="80"
fileref="images/plugins/plugins_14.png" format="PNG"
- />
- </imageobject>
- <imageobject role="html">
- <imagedata align="center"
fileref="images/plugins/plugins_14.png" format="PNG"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>The <emphasis>
- <property>Type Mappings</property>
- </emphasis> page is used for specifying type mappings from JBDC types to any
Hibernate type
- (including usertypes) if the default rules are not applicable. Here again to see
the database
- tables press <emphasis>
- <property>Refresh</property>
- </emphasis> button underneath. More about type mappings you can find further
in the <xref
- linkend="type_map"/> section.</para>
- <figure>
- <title>Type Mappings Page</title>
- <mediaobject>
- <imageobject role="fo">
- <imagedata align="center" scale="80"
fileref="images/plugins/plugins_15.png" format="PNG"
- />
- </imageobject>
- <imageobject role="html">
- <imagedata align="center"
fileref="images/plugins/plugins_15.png" format="PNG"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>The <emphasis>
- <property>Table and Columns</property>
- </emphasis> page allows you to explicit set e.g. which hibernatetype and
propertyname that
- should be used in the reverse engineered model. For more details on how to
configure the
- tables while reverse engineering read the <xref
linkend="tab_and_col"/> section.</para>
- <figure>
- <title>Table and Columns Page</title>
- <mediaobject>
- <imageobject role="fo">
- <imagedata align="center" scale="80"
fileref="images/plugins/plugins_16.png" format="PNG"
- />
- </imageobject>
- <imageobject role="html">
- <imagedata align="center"
fileref="images/plugins/plugins_16.png" format="PNG"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>Now that you have configured all necessary parts, you can learn how to
work with <property
- >Hibernate Console Perspective</property>.</para>
- </section>
- <section id="hib_console">
- <title>Hibernate Console Perspective</title>
- <para>The <property>Hibernate Console Perspective</property>
combines a set of views which allow
- you to see the structure of your mapped entities/classes, edit HQL queries, execute
the
- queries, and see the results. To use this perspective you need to create a
<xref
- linkend="console_conf"/>.</para>
- <section>
- <title>Viewing the entity structure</title>
- <para>To view your new configuration and entity/class structure, switch to
<property>Hibernate
- Configurations View</property>. Expanding the tree allows you to browse
the class/entity
- structure and see the relationships.</para>
- <figure>
- <title>Hibernate Console Perspective</title>
- <mediaobject>
- <imageobject role="fo">
- <imagedata align="center" scale="80"
fileref="images/plugins/plugins_17.png"/>
- </imageobject>
- <imageobject role="html">
- <imagedata align="center"
fileref="images/plugins/plugins_17.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>The <property>Console Configuration</property> does not
dynamically adjust to changes
- done in mappings and java code. To reload the configuration select the
configuration and
- click the <emphasis>
- <property>Reload</property>
- </emphasis> button in the view toolbar or in the context
menu.</para>
- <para>Besides, it's possible to open source and mapping files for
objects showed in
- <property>Hibernate Configurations View</property>. Just bring up
the context menu for a
- necessary object and select <emphasis>
- <property>Open Source File</property>
- </emphasis> to see appropriate Java class or <emphasis>
- <property>Open Mapping File</property>
- </emphasis> to open a proper <emphasis>
- <property>.hbm.xml</property>.</emphasis></para>
- <figure>
- <title>Opening Source for Objects</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/plugins_17_a.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <section id="map_diagram">
- <title>Mapping Diagram</title>
- <para>In order to get a visual feel on how entities are related as well as
view their
- structures, a <property>Mapping Diagram</property> is provided. It
is available by right
- clicking on the entity you want a mapping diagram for and then choosing
<emphasis>
- <property>Mapping
Diagram</property>.</emphasis></para>
- <figure>
- <title>Mapping Diagram</title>
- <mediaobject>
- <imageobject role="fo">
- <imagedata align="center" scale="80"
fileref="images/plugins/plugins_18.png"/>
- </imageobject>
- <imageobject role="html">
- <imagedata align="center"
fileref="images/plugins/plugins_18.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>To make <property>Mapping Diagram</property> usage easier
you can use <property
- >Rules</property>,
<property>Grid</property>,<property>Snap to Geometry</property>
- checkboxes in the <emphasis>
- <property>View</property>
- </emphasis> menu. </para>
- <figure>
- <title>View menu</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/map_diagram1.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>If you will select <emphasis>
- <property>Rules</property>
- </emphasis> checkbox, the view print page scale will be added to the
page. The numbers on
- the scale show its size in inches.If you click on the scale a <emphasis>
- <property>Ruler Guide</property>
- </emphasis> will appear on the diagram. You can connect any diagram item
to it.To connect
- the items you should move their tops to the Ruler Guide. And while moving the
ruler guide,
- the items will be moved together with it as a whole.</para>
- <figure>
- <title>Moving the Ruler guide</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/map_diagram2.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>If you'll select <emphasis>
- <property>Grid</property>
- </emphasis> checkbox, the grid will appear on the diagram.</para>
- <figure>
- <title>Grid on Mapping diagram</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/map_diagram3.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>The checkbox <emphasis>
- <property>Snap to Geometry</property>
- </emphasis> helps to put the items of the diagram into allineation with
the grid.</para>
- <para>For better navigating through the diagram use <property>Outline
view</property> which
- is available in the structural and graphical modes.</para>
- <figure>
- <title>Navigating in the Structural Mode</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/plugins_18_a.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>To switch over between the modes use the buttons in the top-right
corner of the
- <property>Outline view</property>.</para>
- <figure>
- <title>Navigating in the Graphical Mode</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/plugins_18_b.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>The options in the context menu of the mapping diagram are listed in
the next
- table.</para>
- <table>
- <title>Context Menu Options of the Mapping Diagram</title>
- <tgroup cols="3">
- <colspec colnum="1" align="left"
colwidth="1*"/>
- <colspec colnum="2" align="left"
colwidth="1*"/>
- <colspec colnum="3" align="left"
colwidth="3*"/>
- <thead>
- <row>
- <entry align="center">
- <para>Icon</para>
- </entry>
- <entry align="center">
- <para>Command</para>
- </entry>
- <entry align="center">
- <para>Description</para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- <inlinemediaobject>
- <imageobject>
- <imagedata
fileref="images/plugins/toggleConnections.png"/>
- </imageobject>
- </inlinemediaobject>
- </para>
- </entry>
- <entry>
- <para>Show|Hide connections</para>
- </entry>
- <entry>Allows to select what types of connections should be shown
on the diagram: <itemizedlist>
+ <para>Also you need start the <ulink
url="http://docs.jboss.org/tools/resources/GSG_database.zip">...
+ <note>
+ <title>Note:</title>
+ <para>The steps for running the database are documented in the <ulink
url="http://docs.redhat.com/docs/en-US/JBoss_Developer_Studio/4.0/ht...
Started Guide</ulink>.</para>
+ </note>
+ </section>
+ </section>
+ <section id="map_file_wizard">
+ <title>Creating a Hibernate Mapping File</title>
+ <para>Hibernate mapping files are used to specify how your objects relate to
database tables.</para>
+ <para>
+ To create basic mappings for properties and associations, i. e. generate
<filename>.hbm.xml</filename> files, Hibernate Tools provide a basic wizard
which you can display by selecting
<menuchoice><guimenuitem>File</guimenuitem><guimenuitem>New</guimenuitem>
+ <guimenuitem>Hibernate XML mapping file</guimenuitem>
+ </menuchoice>.
+ </para>
+ <para>
+ At first you will be asked to select a package or multiple individual classes to map.
It is also possible to create an empty file: do not select any packages or classes and an
empty <filename>.hbm</filename> file will be created in the specified
location.
+ </para>
+ <para id="depth_control">
+ Using the <property>depth control</property> option you can define the
dependency depth used when choosing classes.
+ </para>
+ <figure>
+ <title>Hibernate XML Mapping File Wizard</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/plugins_0.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ The next wizard page lists the mappings to be generated. You can see the
<guilabel>Customers</guilabel>, <guilabel>Orders</guilabel>,
<guilabel>Productlines</guilabel> and
<guilabel>Products</guilabel> classes added under <property>depth
control</property> driving.
+ </para>
+ <figure>
+ <title>Mappings to be generated</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/plugins_0_a.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>This wizard page display a preview of the generated
<filename>.hbm</filename> files.</para>
+ <figure>
+ <title>Preview Generated Mapping Files</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/plugins_0_b.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>Clicking the <guibutton>Finish</guibutton> button creates the
files.</para>
+ </section>
+ <section id="hib_config_file">
+ <title>Creating a Hibernate Configuration File</title>
+ <para>
+ To be able to perform reverse engineering, prototype queries, and of course to simply
use <property>Hibernate Core</property> a
<filename>hibernate.properties</filename> or
<filename>hibernate.cfg.xml</filename> file is needed.
<property>Hibernate Tools</property> provides a wizard for generating the
<filename>hibernate.cfg.xml</filename> file if you do not already have one.
+ </para>
+ <para>Start the wizard by clicking
<menuchoice><guimenuitem>File</guimenuitem><guimenuitem>New</guimenuitem>
+ <guimenuitem>Other</guimenuitem>
+ </menuchoice> (<keycombo><keycap>Ctrl</keycap>
+ <keycap>N</keycap>
+ </keycombo>), then select
+
+ <menuchoice><guimenuitem>Hibernate</guimenuitem>
+ <guimenuitem>Hibernate Configuration File (cfg.xml)</guimenuitem>
+ </menuchoice> and click the <guibutton>Next</guibutton>
button.</para>
+ <figure>
+ <title>Hibernate Configuration File Wizard</title>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata align="center"
fileref="images/plugins/plugins_1.png" format="PNG"/>
+ </imageobject>
+ <imageobject role="html">
+ <imagedata align="center"
fileref="images/plugins/plugins_1.png" format="PNG"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <note>
+ <title>Note:</title>
+ <para>
+ The contents in the comboboxes for the JDBC driver class and JDBC URL change
automatically, depending on the Dialect and actual driver you have chosen.
+ </para>
+ </note>
+ <para>
+ Enter your configuration information in this dialog. Details about the configuration
options can be found in <ulink
url="http://docs.jboss.org/ejb3/app-server/Hibernate3/reference/en/h...
Reference Documentation</ulink>.
+ </para>
+ <para>
+ Click the <guibutton>Finish</guibutton> button to create the configuration
file, and after optionally creating a Console configuration, the
<filename>hibernate.cfg.xml</filename> file will be automatically opened in an
editor. The last option, <guilabel>Create Console Configuration</guilabel>, is
enabled by default and when enabled, it will automatically use the
<filename>hibernate.cfg.xml</filename> file for the basis of a Console
configuration.
+ </para>
+ </section>
+ <section id="console_conf">
+ <title>Hibernate Console Configuration</title>
+ <para>
+ A Console configuration describes how the <property>Hibernate
plugin</property> should configure <property>Hibernate</property> and
what configuration files and classpaths are needed to load the POJO's, JDBC drivers
etc. It is required to make use of query prototyping, reverse engineering and code
generation. You can have multiple named console configurations. Normally you would just
need one per project, but it is definitely possible to create more if required.
+ </para>
+ <section id="creat_console_conf">
+ <title>Creating a Hibernate Console Configuration</title>
+ <para>
+ You can create a console configuration by running the <guilabel>Console
Configuration Wizard</guilabel>, shown in the following screenshot. The same wizard
will also be used if you are coming from the
<filename>hibernate.cfg.xml</filename> wizard and had enabled the
<guilabel>Create Console Configuration</guilabel> option.
+ </para>
+ <note>
+ <title>Note:</title>
+ <para>
+ The wizard will look at the current selection in the IDE and try to auto-detect the
appropriate settings, which you then can approve or modify to suit your needs.
+ </para>
+ </note>
+ <para/>
+ <para>The dialog consists of five tabs: </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <guilabel>Main</guilabel>, which displays the basic and required
settings</para>
+ </listitem>
+ </itemizedlist>
+ <figure>
+ <title> Creating Hibernate Console Configuration</title>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata align="center"
fileref="images/plugins/plugins_2.png" format="PNG"/>
+ </imageobject>
+ <imageobject role="html">
+ <imagedata align="center"
fileref="images/plugins/plugins_2.png" format="PNG"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ The following table describes the available settings on the
<guilabel>Main</guilabel> tab. The wizard can automatically detect the default
values for most of the settings if you started the wizard with the relevant Java project
or resource selected.
+ </para>
+ <table>
+ <title>Hibernate Console Configuration Parameters</title>
+ <tgroup cols="3">
+ <colspec colnum="1" align="left"
colwidth="1*"/>
+ <colspec colnum="2" colwidth="3*"/>
+ <colspec colnum="3" align="left"
colwidth="1*"/>
+ <thead>
+ <row>
+ <entry align="center">
+ <para>Parameter</para>
+ </entry>
+ <entry align="center">
+ <para>Description</para>
+ </entry>
+ <entry align="center">
+ <para>Auto detected value</para>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para>Name</para>
+ </entry>
+ <entry>
+ <para>The unique name of the console configuration</para>
+ </entry>
+ <entry>
+ <para>Name of the selected project</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Type</para>
+ </entry>
+ <entry>
+ <para>
+ Choose between "Core", "Annotations" and
"JPA". Note that the two latter requires running Eclipse IDE with a JDK
5 runtime, otherwise you will get class loading and/or version errors.
+ </para>
+ </entry>
+ <entry>
+ <para>No default value</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Project</para>
+ </entry>
+ <entry>
+ <para>The name of a Java project whose classpath should be used in the
console configuration</para>
+ </entry>
+ <entry>
+ <para>Name of the selected project</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Database connection</para>
+ </entry>
+ <entry>
+ <para>
+ DTP provided connection that you can use instead of what is defined in the
<filename>cfg.xml</filename> and JPA
<filename>persistence.xml</filename> files. It is possible to use an already
configured Hibernate or JPA connection, or specify a new one here.
+ </para>
+ </entry>
+ <entry>
+ <para>[Hibernate Configured connection]</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Property file</para>
+ </entry>
+ <entry>
+ <para>Path to a <filename>hibernate.properties</filename>
file</para>
+ </entry>
+ <entry>
+ <para>First <filename>hibernate.properties</filename> file
found in the selected project</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Configuration file</para>
+ </entry>
+ <entry>
+ <para>Path to a <filename>hibernate.cfg.xml</filename>
file</para>
+ </entry>
+ <entry>
+ <para>First <filename>hibernate.cfg.xml</filename> file found
in the selected project</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Persistence unit</para>
+ </entry>
+ <entry>
+ <para>Name of the persistence unit to use</para>
+ </entry>
+ <entry>
+ <para>
+ No default value (let Hibernate Entity Manager find the persistence unit or it
can be defined manually using the <guibutton>Browse</guibutton> button)
+ </para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <note>
+ <title>Tip:</title>
+ <para>
+ The two latter settings are usually not required if you specify a project that has a
<filename> /hibernate.cfg.xml </filename> or
<filename>/META-INF/persistence.xml</filename> file in its
classpath.</para>
+ </note>
+ <itemizedlist>
+ <listitem>
+ <para>
+ The <guilabel>Options</guilabel> tab the optional
settings</para>
+ </listitem>
+ </itemizedlist>
+ <figure>
+ <title>Options Tab of the Console Configuration Wizard</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/plugins_2_a.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>The next table describes the Hibernate Console Configuration options
available on the <guilabel>Options</guilabel> tab.</para>
+ <table>
+ <title>Hibernate Console Configuration Options</title>
+ <tgroup cols="3">
+ <colspec colnum="1" align="left"
colwidth="1*"/>
+ <colspec colnum="2" colwidth="3*"/>
+ <colspec colnum="3" align="left"
colwidth="1*"/>
+ <thead>
+ <row>
+ <entry align="center">
+ <para>Parameter</para>
+ </entry>
+ <entry align="center">
+ <para>Description</para>
+ </entry>
+ <entry align="center">
+ <para>Auto detected value</para>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para>Database dialect</para>
+ </entry>
+ <entry>
+ <para>Define a database dialect. It is possible either to enter your own
value or choose from list. </para>
+ </entry>
+ <entry>
+ <para>No default value</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Naming strategy</para>
+ </entry>
+ <entry>
+ <para>Fully qualified class name of a custom
<code>NamingStrategy</code>. Only required if you use a special naming
strategy.</para>
+ </entry>
+ <entry>
+ <para>No default value</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Entity resolver</para>
+ </entry>
+ <entry>
+ <para>Fully qualified class name of a custom
<code>EntityResolver</code>. Only required if you have special XML entity
includes in your mapping files.</para>
+ </entry>
+ <entry>
+ <para>No default value</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <itemizedlist>
+ <listitem>
+ <para><guilabel>Classpath</guilabel> for classpath</para>
+ </listitem>
+ </itemizedlist>
+ <figure>
+ <title>Specifying Classpath in Hibernate Console Configuration</title>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata align="center"
fileref="images/plugins/plugins_3.png" format="PNG"/>
+ </imageobject>
+ <imageobject role="html">
+ <imagedata align="center"
fileref="images/plugins/plugins_3.png" format="PNG"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>The following table specifies the parameters of the
<guilabel>Classpath</guilabel> tab of the wizard.</para>
+ <table>
+ <title>Hibernate Console Configuration Classpath</title>
+ <tgroup cols="3">
+ <colspec colnum="1" align="left"
colwidth="1*"/>
+ <colspec colnum="2" colwidth="3*"/>
+ <colspec colnum="3" colwidth="1*"/>
+ <thead>
+ <row>
+ <entry align="center">
+ <para>Parameter</para>
+ </entry>
+ <entry align="center">
+ <para>Description</para>
+ </entry>
+ <entry align="center">
+ <para>Auto detected value</para>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para>Classpath</para>
+ </entry>
+ <entry>
+ <para>
+ The classpath for loading POJO and JDBC drivers; only needed if the default
classpath of the Project does not contain the required classes. Do not add Hibernate core
libraries or dependencies, they are already included. If you get ClassNotFound errors then
check this list for possible missing or redundant directories or JAR files.
+ </para>
+ </entry>
+ <entry>
+ <para>Empty</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Include default classpath from project</para>
+ </entry>
+ <entry>
+ <para>When enabled the project classpath will be appended to the classpath
specified above</para>
+ </entry>
+ <entry>
+ <para>Enabled</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <guilabel>Mappings</guilabel> for additional mappings</para>
+ </listitem>
+ </itemizedlist>
+ <figure>
+ <title>Specifying additional Mappings in Hibernate Console
Configuration</title>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata align="center"
fileref="images/plugins/plugins_4.png" format="PNG"/>
+ </imageobject>
+ <imageobject role="html">
+ <imagedata align="center"
fileref="images/plugins/plugins_4.png" format="PNG"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>Parameters of the <guilabel>Mappings</guilabel> tab of the
<property>Hibernate Console Configuration wizard</property> are explained
below:</para>
+ <table>
+ <title>Hibernate Console Configuration Mappings</title>
+ <tgroup cols="3">
+ <colspec colnum="1" align="left"
colwidth="1*"/>
+ <colspec colnum="2" colwidth="3*"/>
+ <colspec colnum="3" colwidth="1*"/>
+ <thead>
+ <row>
+ <entry align="center">
+ <para>Parameter</para>
+ </entry>
+ <entry align="center">
+ <para>Description</para>
+ </entry>
+ <entry align="center">
+ <para>Auto detected value</para>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para>Mapping files </para>
+ </entry>
+ <entry>
+ <para>
+ List of additional mapping files that should be loaded. Note: A
<filename>hibernate.cfg.xml</filename> or
<filename>persistence.xml</filename> can also contain mappings. Thus if these
are duplications here, you will get "Duplicate mapping" errors when using the
console configuration.
+ </para>
+ </entry>
+ <entry>
+ <para>empty</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <itemizedlist>
+ <listitem>
+ <para>and the last tab <guilabel>Common</guilabel>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <figure>
+ <title>Common Tab of the Console Configuration Wizard</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/plugins_4_a.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>The <guilabel>Common</guilabel> tab allows you to define the
general aspects of the launch configuration including storage location, console encoding
and some others.</para>
+ <para>
+ Clicking the <guibutton>Finish</guibutton> button creates the
configuration and shows it in the <property>Hibernate Configurations
view</property>.
+ </para>
+ <figure>
+ <title>Console Overview</title>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata align="center"
fileref="images/plugins/plugins_5.png" format="PNG"/>
+ </imageobject>
+ <imageobject role="html">
+ <imagedata align="center"
fileref="images/plugins/plugins_5.png" format="PNG"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </section>
+ <section id="modif_console_conf">
+ <title>Modifying a Hibernate Console Configuration </title>
+ <para>When you created a Hibernate Console Configuration you can modify it in
two ways: </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Right-click on the configuration in the <guilabel>Hibernate Configurations
View</guilabel> and select <guimenuitem>Edit
Configuration</guimenuitem>, or just double-click on the <guilabel>Console
Configuration</guilabel> item.
+ </para>
+ <figure>
+ <title>Opening Edit Configuration Wizard</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/plugins_4_c.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ You will then see the <guilabel>Edit Configuration Wizard</guilabel>,
which is similar to <guilabel>Create Console Configuration</guilabel>,
described in <xref linkend="creat_console_conf"/>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>Use the <guilabel>Properties</guilabel> view to modify the
Console Configuration properties.</para>
+ <figure>
+ <title>Properties View</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/plugins_4_b.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ The following table describes the available settings in the
<guilabel>Properties</guilabel> view. Most properties can be changed by left
clicking on them, but some can not.
+ <table>
+ <title>Properties</title>
+ <tgroup cols="3">
+ <colspec colnum="1" align="left"
colwidth="1*"/>
+ <colspec colnum="2" colwidth="3*"/>
+ <colspec colnum="3" align="left"
colwidth="1*"/>
+ <thead>
+ <row>
+ <entry align="center">
+ <para>Property</para>
+ </entry>
+ <entry align="center">
+ <para>Description</para>
+ </entry>
+ <entry align="center">
+ <para>Is Changeable</para>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para>Additional mapping files </para>
+ </entry>
+ <entry>
+ <para>Count of additional mapping files that should be loaded.
</para>
+ </entry>
+ <entry>
+ <para>False</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Configuration file</para>
+ </entry>
+ <entry>
+ <para>Path to a <filename>hibernate.cfg.xml</filename>
file</para>
+ </entry>
+ <entry>
+ <para>False</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Connection</para>
+ </entry>
+ <entry>
+ <para>
+ DTP provided connection that you can use instead of what is in the
<filename>cfg.xml</filename> and JPA
<filename>persistence.xml</filename> files. It is possible to use either an
already configured Hibernate or JPA connection, or specify a new one here.
+ </para>
+ </entry>
+ <entry>
+ <para>True</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Name</para>
+ </entry>
+ <entry>
+ <para>The unique name of the console configuration</para>
+ </entry>
+ <entry>
+ <para>True</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Project</para>
+ </entry>
+ <entry>
+ <para>The name of a Java project which classpath should be used in the
console configuration</para>
+ </entry>
+ <entry>
+ <para>True</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Properties file</para>
+ </entry>
+ <entry>
+ <para>Path to a <filename>hibernate.properties</filename>
file</para>
+ </entry>
+ <entry>
+ <para>False</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Type</para>
+ </entry>
+ <entry>
+ <para>
+ Choose between "CORE", "ANNOTATIONS" and
"JPA" according to the method of relational mapping you want to
+ use. Note, the two latter requires running Eclipse IDE with a JDK
5 runtime, otherwise you will get class loading and/or version errors.
+ </para>
+ </entry>
+ <entry>
+ <para>True</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+ </listitem>
+ </itemizedlist>
+ </section>
+ <section id="closing_conf_config">
+ <title>Closing Hibernate Console Configuration</title>
+ <para>
+ To close <guilabel>Hibernate Console Configuration</guilabel> you need to
right-click your configuration and choose the <guimenuitem>Close
Configuration</guimenuitem> option.
+ </para>
+ <figure>
+ <title>Close Hibernate Console Configuration</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/plugins_4_d.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ When closing the configuration the connection with database will be closed, JAR libs
will be unlock (for Windows) and other resources will set as free.
+ </para>
+ </section>
+ </section>
+ <section id="refeng_codegen" role="updated">
+ <title>Reverse Engineering and Code Generation</title>
+ <para>
+ Hibernate provides "click-and-generate" reverse engineering and code
generation facilities. This allows you to generate a range of artifacts based on database
or an existing Hibernate configuration, be that mapping files or annotated classes. Some
of these are POJO Java source files, Hibernate <filename>.hbm.xml</filename>
files, <filename>hibernate.cfg.xml</filename> generation and schema
documentation.
+ </para>
+ <para>
+ To start working with this process, start the <guilabel>Hibernate Code
Generation</guilabel> tool which is available from the toolbar via the
<property>Hibernate</property> icon or via the
<menuchoice><guimenuitem>Run</guimenuitem><guimenuitem>Hibernate
Code Generation</guimenuitem></menuchoice> menu item.
+ </para>
+ <section id="code_gen">
+ <title>Code Generation Launcher</title>
+ <para>
+ When you click on the <guimenuitem>Open Hibernate Code Generation
Dialog...</guimenuitem> option the standard Eclipse launcher dialog will appear. In
this dialog you can create, edit and delete named Hibernate code generation
"launchers".
+ </para>
+ <figure id="hib_code_gen">
+ <title>Getting Hibernate Code Generation Launcher</title>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata fileref="images/plugins/plugins_6.png"
format="PNG"/>
+ </imageobject>
+ <imageobject role="html">
+ <imagedata align="center"
fileref="images/plugins/plugins_6.png" format="PNG"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para/>
+ <figure>
+ <title>Hibernate Code Generation Launcher</title>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata align="center" scale="80"
fileref="images/plugins/plugins_7.png" format="PNG" />
+ </imageobject>
+ <imageobject role="html">
+ <imagedata align="center"
fileref="images/plugins/plugins_7.png" format="PNG"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ The first time you create a code generation launcher you should give it a meaningful
name, otherwise the default prefix <guilabel>New_Generation</guilabel> will be
used.
+ </para>
+ <note>
+ <title>Tip:</title>
+ <para>
+ The "At least one exporter option must be selected" warning
indicates that for this launcher to work you need to select an exporter on the
<guilabel>Exporter</guilabel> tab. When an exporter has been selected the
warning will disappear.
+ </para>
+ </note>
+ <para>
+ The dialog also has the standard <guilabel>Refresh</guilabel> and
<guilabel>Common</guilabel> tabs that can be used to configure which
directories should be automatically refreshed and various general settings for launchers,
such as saving them in a project for sharing the launcher within a team.
+ </para>
+ <para>On the <guilabel>Main</guilabel> tab you see the following
fields:</para>
+ <table>
+ <title>Code generation "Main" tab fields</title>
+ <tgroup cols="2">
+ <colspec colnum="1" align="left"
colwidth="1*"/>
+ <colspec colnum="2" colwidth="3*"/>
+ <colspec colnum="3" colwidth="0.5*"/>
+ <thead>
+ <row>
+ <entry align="center">
+ <para>Field</para>
+ </entry>
+ <entry align="center">
+ <para>Description</para>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para>Console Configuration</para>
+ </entry>
+ <entry>
+ <para>The name of the console configuration that should be used when
generating code</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Output directory</para>
+ </entry>
+ <entry>
+ <para>
+ The default location where all output will be written to. It's possible to
enter absolute directory path, for example - <filename>d:/temp</filename>. Be
aware that existing files will be overwritten, so be sure to specify the correct
directory.
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Reverse engineer from JDBC Connection</para>
+ </entry>
+ <entry>
+ <para>
+ If enabled, the tools will reverse engineer the database defined in the
connection information in the selected Hibernate Console Configuration, and generate code
based on the database schema. If not enabled, the code generation will be based on the
existing mappings specified in the Hibernate Console configuration.
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Package</para>
+ </entry>
+ <entry>
+ <para>The package name here is used as the default package name for any
entities found when reverse engineering</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>reveng.xml</para>
+ </entry>
+ <entry>
+ <para>
+ Path to a <filename>reveng.xml</filename> file. A
<filename>reveng.xml</filename> file allows you to control certain aspects of
the reverse engineering process such as how JDBC types are mapped to Hibernate types, and
which tables are included and excluded from the process (which is especially important).
Clicking the <guibutton>Setup</guibutton> button allows you to select an
existing <filename>reveng.xml</filename> file, or create a new one. See more
details about the <filename>reveng.xml</filename> file in <xref
linkend="reverseengineering"/>.
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>reveng. strategy</para>
+ </entry>
+ <entry>
+ <para>
+ If the <filename>reveng.xml</filename> file does not provide enough
customization you can provide your own implementation of a
<code>ReverseEngineeringStrategy</code>. The class needs to be in the
classpath of the Console Configuration, otherwise you will get class not found exceptions.
See <xref linkend="custom-reveng-strategy"/> for details and an example of
a custom strategy.
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Generate basic typed composite ids</para>
+ </entry>
+ <entry>
+ <para>
+ When a table that has a multi-column primary key a
<code><composite-id></code> mapping will always be created. If
this option is enabled and there are matching foreign-keys, each key column is still
considered a 'basic' scalar (string, long, etc.) instead of a reference to an
entity. If you disable this option a
<code><key-many-to-one></code> instead. Note: a
<code><many-to-one></code> property is still created, but is
simply marked as non-updatable and non-insertable.
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Detect optimistic lock columns</para>
+ </entry>
+ <entry>
+ <para>
+ Automatically detect optimistic lock columns. Controllable via reveng. strategy;
the current default is to use columns named VERSION or TIMESTAMP.
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Detect many-to-many tables</para>
+ </entry>
+ <entry>
+ <para>Automatically detect many-to-many tables. Controllable via reveng.
strategy.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Detect one-to-one associations</para>
+ </entry>
+ <entry>
+ <para>
+ Reverse engineering detects one-to-one associations via primary key and both the
<filename>hbm.xml</filename> file and annotation generation generates the
proper code for it.
+ </para>
+ <para>
+ The detection is enabled by default (except for Seam 1.2 and Seam 2.0) reverse
engineering. For Hibernate Tools generation there is a checkbox to disable this feature if
it is not required.
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Use custom templates</para>
+ </entry>
+ <entry>
+ <para>
+ If enabled, the Template directory will be searched first when looking up the
templates, allowing you to redefine how the individual templates process the hibernate
mapping model.
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Template directory</para>
+ </entry>
+ <entry>
+ <para>A path to a directory with custom templates</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
+ <section id="exportes">
+ <title>Exporters</title>
+ <para>
+ The <guilabel>Exporters</guilabel> tab is used to specify the type of
code that should be generated. Each selection represents an Exporter that is responsible
for generating the code, hence the name.
+ </para>
+ <figure>
+ <title>Selecting Exporters</title>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata align="center" scale="80"
fileref="images/plugins/plugins_8.png" format="PNG" />
+ </imageobject>
+ <imageobject role="html">
+ <imagedata align="center"
fileref="images/plugins/plugins_8.png" format="PNG"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ The following table provides a short description of the various exporters. Remember
you can add and remove any Exporters depending on your needs.
+ </para>
+ <table>
+ <title>Code generation "Exporter" tab fields</title>
+ <tgroup cols="2">
+ <colspec colnum="1" align="left"
colwidth="1*"/>
+ <colspec colnum="2" colwidth="3*"/>
+ <thead>
+ <row>
+ <entry align="center">
+ <para>Field</para>
+ </entry>
+ <entry align="center">
+ <para>Description</para>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para>Domain code</para>
+ </entry>
+ <entry>
+ <para>Generates POJO's for all the persistent classes and components
found in the given Hibernate configuration.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>DAO code</para>
+ </entry>
+ <entry>
+ <para>Generates a set of DAO's for each entity found.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Hibernate XML Mappings</para>
+ </entry>
+ <entry>
+ <para>Generate mapping (<filename>hbm.xml</filename>) files for
each entity.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Hibernate XML Configuration</para>
+ </entry>
+ <entry>
+ <para>
+ Generate a <filename>hibernate.cfg.xml</filename> file. Used to keep
the <filename>hibernate.cfg.xml</filename> file updated with any newly
discovered mapping files.
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Schema Documentation (.html)</para>
+ </entry>
+ <entry>
+ <para>Generates a set of HTML pages that documents the database schema and
some of the mappings.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Generic Exporter (hbmtemplate)</para>
+ </entry>
+ <entry>
+ <para>Fully customizable exporter that can be used to perform custom
generation.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Schema Export (.ddl)</para>
+ </entry>
+ <entry>
+ <para>Generates the appropriate SQL DDL and allows you to store the result
in a file or export it directly to the database.</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <para>
+ Each Exporter listens to certain properties which can be setup in the
<guilabel>Properties</guilabel> section where you can add and remove
predefined or customer properties for each of the exporters. The following table lists the
time of writing predefined properties:
+ </para>
+ <para>
+ <table>
+ <title>Exporter Properties</title>
+ <tgroup cols="2">
+ <colspec colnum="1" align="left"
colwidth="1*"/>
+ <colspec colnum="2" colwidth="3*"/>
+ <thead>
+ <row>
+ <entry align="center">
+ <para>Name</para>
+ </entry>
+ <entry align="center">
+ <para>Description</para>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para>jdk5</para>
+ </entry>
+ <entry>
+ <para>Generate Java 5 syntax</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>ejb3</para>
+ </entry>
+ <entry>
+ <para>Generate EJB 3 annotations</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>for_each</para>
+ </entry>
+ <entry>
+ <para>
+ Specifies for which type of model elements the exporter should create a file
and run through the templates. Possible values are: entity, component, configuration
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>template_path</para>
+ </entry>
+ <entry>
+ <para>Custom template directory for this specific exporter. You can use
Eclipse variables.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>template_name</para>
+ </entry>
+ <entry>
+ <para>Name for template relative to the template path</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>outputdir</para>
+ </entry>
+ <entry>
+ <para>Custom output directory for this specific exporter. You can use
Eclipse variables.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>file_pattern</para>
+ </entry>
+ <entry>
+ <para>
+ Pattern to use for the generated files, relatively for the output dir. Example:
<filename>{package-name}/{class-name}.java</filename>.
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>dot.executable</para>
+ </entry>
+ <entry>
+ <para>Executable to run GraphViz (only relevant, but optional for Schema
documentation)</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>drop</para>
+ </entry>
+ <entry>
+ <para>Output will contain drop statements for the tables, indices and
constraints</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>delimiter</para>
+ </entry>
+ <entry>
+ <para>If specified the statements will be dumped to this
file</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>create</para>
+ </entry>
+ <entry>
+ <para>Output will contain create statements for the tables, indices and
constraints</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>scriptToConsole</para>
+ </entry>
+ <entry>
+ <para>The script will be output to Console</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>exportToDatabase</para>
+ </entry>
+ <entry>
+ <para>Executes the generated statements against the database</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>outputFileName</para>
+ </entry>
+ <entry>
+ <para>If specified the statements will be dumped to this
file</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>haltOnError</para>
+ </entry>
+ <entry>
+ <para>Halts the build process if an error occurs</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>format</para>
+ </entry>
+ <entry>
+ <para>Applies basic formatting to the statements</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>schemaUpdate</para>
+ </entry>
+ <entry>
+ <para>Updates a schema</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+ <para>
+ To add a property to the chosen Exporter click the
<guibutton>Add</guibutton> button in the
<guilabel>Properties</guilabel> section. In the resulting dialog you should
select the property from the proposed list and the value for it.
+ </para>
+ <figure>
+ <title>Adding the Property for Schema Export (.ddl)</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/plugins_8a.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <note>
+ <title>Tip:</title>
+ <para>If the property is a directory, it is possible to browse directories in
the <guilabel>Value</guilabel> field.</para>
+ </note>
+ <figure>
+ <title>Specifying the Property Value</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/plugins_8b.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </section>
+ </section>
+ <section id="map_config_editor">
+ <title>Hibernate Mapping and Configuration File Editor</title>
+ <para>
+ The <property>Hibernate Mapping File editor</property> provides XML
editing functionality for the <filename>hbm.xml</filename> and
<filename>cfg.xml</filename> files. The editor is based on the Eclipse WTP
tools and extends its functionality to provide Hibernate specific code completion.
+ </para>
+ <figure>
+ <title>XML Editing Functionality</title>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata align="center" scale="80"
fileref="images/plugins/plugins_9.png" format="PNG"/>
+ </imageobject>
+ <imageobject role="html">
+ <imagedata align="center"
fileref="images/plugins/plugins_9.png" format="PNG"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <section>
+ <title>Java property/class completion</title>
+ <para>
+ Package, class, and field completion is enabled for relevant XML attributes. The
auto-completion tool detects its context and limits the completion for a tag (such as
<code><property></code>) and only shows the properties and
fields available in the enclosing <code><class></code>,
<code><subclass></code> etc. It is also possible to navigate
from the <filename>hbm.xml</filename> files to the relevant classes and fields
in your Java code.
+ </para>
+ <figure>
+ <title>Navigation Functionality</title>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata align="center"
fileref="images/plugins/plugins_10.png" format="PNG"
scale="80"/>
+ </imageobject>
+ <imageobject role="html">
+ <imagedata align="center"
fileref="images/plugins/plugins_10.png" format="PNG"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ This is done via the standard hyperlink navigation functionality in Eclipse. By
default this is done by pressing <keycap>F3</keycap> while the cursor is on a
class or field, or by pressing <keycap>Ctrl</keycap> and the mouse button.
+ </para>
+ <para>For Java completion and navigation to work the file needs to reside inside
an Eclipse Java project, otherwise the feature is not available.</para>
+ <note>
+ <title>Note:</title>
+ <para>Java completion does not require a Hibernate console configuration to be
used.</para>
+ </note>
+ </section>
+ <section>
+ <title>Table/Column completion</title>
+ <para>Table and column completion is also available for all table and column
attributes. </para>
+ <figure>
+ <title>Table and Column Completion</title>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata align="center" scale="80"
fileref="images/plugins/plugins_11.png" format="PNG"/>
+ </imageobject>
+ <imageobject role="html">
+ <imagedata align="center"
fileref="images/plugins/plugins_11.png" format="PNG"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <important>
+ <title>Important:</title>
+ <para>
+ Table and Column completion requires a properly configured Hibernate console
configuration, and this configuration should be the default for the project where the
<filename>hbm.xml</filename> resides.
+ </para>
+ </important>
+ <para>
+ You can check which console configuration is selected in the Properties of a project
under the <guilabel>Hibernate Settings</guilabel> page. When a proper
configuration is selected it will be used to fetch the table and column names in the
background.
+ </para>
+ <note>
+ <title>Note:</title>
+ <para>
+ Currently it is not recommended to use this feature on large databases since it does
not fetch the information iteratively. This will be improved in future versions.
+ </para>
+ </note>
+ </section>
+ <section>
+ <title>Configuration property completion</title>
+ <para>
+ Code completion for the value of <code><property>
name</code> attributes are available when editing the
<filename>cfg.xml</filename> file.
+ </para>
+ <figure>
+ <title>Property Completion</title>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata align="center" scale="80"
fileref="images/plugins/plugins_12.png" format="PNG"/>
+ </imageobject>
+ <imageobject role="html">
+ <imagedata align="center"
fileref="images/plugins/plugins_12.png" format="PNG"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </section>
+ </section>
+ <section id="map_config_struct_editor">
+ <title>Structured Hibernate Mapping and Configuration File Editor</title>
+ <para>
+ The structured editor represents a file in a tree form. It also provides a way to
modify the structure of the file and its elements with the help of tables provided on the
right-hand area.
+ </para>
+ <para>
+ To open any mapping file in the editor, select
<menuchoice><guimenuitem>Open
With</guimenuitem><guimenuitem>Hibernate 3.0 XML
Editor</guimenuitem></menuchoice> from the context menu of the file. The
editor is shown in the following image:
+ </para>
+ <figure>
+ <title>Structured hbm.xml Editor</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/plugins_12_a.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ For the configuration file you should select <menuchoice><guimenuitem>Open
With</guimenuitem><guimenuitem>Hibernate Configuration 3.0 XML
Editor</guimenuitem></menuchoice>.
+ </para>
+ <figure>
+ <title>Structured cfg.xml Editor</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/plugins_12_b.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </section>
+ <section id="properties_editor">
+ <title>JBoss Tools Properties Editor</title>
+ <para>
+ The editor is designed to edit <filename>.properties</filename> files. It
contains two tabs: the <guilabel>Properties</guilabel> (UI) tab and the
<guilabel>Source</guilabel> tab for manual editing.
+ </para>
+ <para>
+ For <filename>hibernate.properties</filename> files the
<guilabel>JBoss Tools Properties Editor</guilabel> provides content assist for
both Hibernate properties and values. You can make use of the content assist while editing
the file in the <guilabel>Source</guilabel> view and in the
<guilabel>Properties</guilabel> view of the editor.
+ </para>
+ <para>To add the property in the <guilabel>Properties</guilabel>
view, click the <guibutton>Add</guibutton> button.</para>
+ <figure>
+ <title>Adding the Property</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/add_property1.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ In the <guilabel>Name</guilabel> field press
<keycombo><keycap>Ctrl</keycap><keycap>Space</keycap></keycombo>
to invoke the content assist. It will suggest
<code>'hibernate.'</code> which is the prefix for all
hibernate properties. After selecting
<code>'hibernate.'</code> and invoking the content assist
again, other prefixes and properties are displayed as the proposals, with a description
for each one.
+ </para>
+ <figure>
+ <title>Content Assist for Properties Names</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/add_property2.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>When invoking the content assist in the
<guilabel>Value</guilabel> field, it also provides a list of
proposals.</para>
+ <figure>
+ <title>Content Assist for Properties Values</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/add_property3.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>In the <guilabel>Source</guilabel> view of the editor, content
assist can also be invoked both for properties names and values:</para>
+ <figure>
+ <title>Content Assist in the Source view</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/add_property4.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <figure>
+ <title>Content Assist in the Source view</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/add_property5.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </section>
+ <section id="rev_xml_editor">
+ <title>Reveng.xml Editor</title>
+ <para>
+ A <filename>reveng.xml </filename> file is used to customize and control
how reverse engineering is performed by the tools. The plugins provide an editor to assist
in editing this file.
+ </para>
+ <para>
+ The editor is intended to allow easy definition of type mappings, table include and
excludes, and specific override settings for columns, e.g. define an explicit name for a
column when the default naming rules are not applicable.
+ </para>
+ <note>
+ <title>Note:</title>
+ <para>
+ Not all the features of the <filename>.reveng.xml</filename> file are
exposed or fully implemented in the editor, but the main functionality is there. To
understand the full flexibility of the <filename>reveng.xml</filename> file,
please see <xref linkend="hibernaterevengxmlfile"/>
+ </para>
+ </note>
+ <para>
+ The editor is activated as soon as a <filename>.reveng.xml </filename>
file is opened. To create an initial <filename>reveng.xml </filename> file the
<guilabel>Reverse Engineering File Wizard</guilabel> can be started by
pressing
<keycombo><keycap>Ctrl</keycap><keycap>N</keycap></keycombo>
and then selecting
<menuchoice><guimenuitem>Hibernate</guimenuitem><guimenuitem>Hibernate
Reverse Engineering File (reveng.xml)</guimenuitem></menuchoice>.
+ </para>
+ <figure>
+ <title>ChooseReverse Engineering File Wizard </title>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata align="center" scale="80"
fileref="images/plugins/plugins_22.png" format="PNG" />
+ </imageobject>
+ <imageobject role="html">
+ <imagedata align="center"
fileref="images/plugins/plugins_22.png" format="PNG"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ Or you can get it via the <guilabel>Code Generation Launcher</guilabel> by
checking the appropriate section in the <guilabel>Main</guilabel> tab of the
<guilabel>Getting Hibernate Code Generation Wizard</guilabel> (see <xref
linkend="hib_code_gen"/>).
+ </para>
+ <para>
+ The following screenshot shows the <guilabel>Overview</guilabel> page
where the appropriate console configuration is selected (it is auto-detected if Hibernate
3 support is enabled for the project).
+ </para>
+ <figure>
+ <title>Overview Page</title>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata align="center" scale="80"
fileref="images/plugins/plugins_13.png" format="PNG" />
+ </imageobject>
+ <imageobject role="html">
+ <imagedata align="center"
fileref="images/plugins/plugins_13.png" format="PNG"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ The <guilabel>Table Filter</guilabel> page allows you to specify which
tables to include and exclude. Clicking the <guibutton>Refresh</guibutton>
button shows the tables from the database that have not yet been excluded.
+ </para>
+ <figure>
+ <title>Table Filters Page</title>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata align="center" scale="80"
fileref="images/plugins/plugins_14.png" format="PNG" />
+ </imageobject>
+ <imageobject role="html">
+ <imagedata align="center"
fileref="images/plugins/plugins_14.png" format="PNG"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ The <guilabel>Type Mappings</guilabel> page is used to specify type
mappings from JBDC types to any Hibernate type (including user types) if the default rules
are not applicable. To see the database tables press the
<guibutton>Refresh</guibutton> button underneath. For more information on type
mappings please see the <xref linkend="type_map"/> section.
+ </para>
+ <figure>
+ <title>Type Mappings Page</title>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata align="center" scale="80"
fileref="images/plugins/plugins_15.png" format="PNG" />
+ </imageobject>
+ <imageobject role="html">
+ <imagedata align="center"
fileref="images/plugins/plugins_15.png" format="PNG"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ The <guilabel>Table and Columns</guilabel> page allows you to explicitly
set which details (e.g. which hibernatetype and propertyname) should be used in the
reverse engineered model. For more details on how to configure the tables while reverse
engineering read <xref linkend="tab_and_col"/>.
+ </para>
+ <figure>
+ <title>Table and Columns Page</title>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata align="center" scale="80"
fileref="images/plugins/plugins_16.png" format="PNG" />
+ </imageobject>
+ <imageobject role="html">
+ <imagedata align="center"
fileref="images/plugins/plugins_16.png" format="PNG"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </section>
+ <section id="hib_console">
+ <title>Hibernate Console Perspective</title>
+ <para>
+ The <guilabel>Hibernate Console Perspective</guilabel> combines a set of
views which allow you to see the structure of your mapped entities and classes, edit HQL
queries, execute the queries, and view the results. To use this perspective you need to
create a <guilabel>Hibernate Console Configuration</guilabel> (see <xref
linkend="console_conf"/> for more information).
+ </para>
+ <section>
+ <title>Viewing the entity structure</title>
+ <para>
+ To view your new configuration and entity or class structure, switch to the
<guilabel>Hibernate Configurations View</guilabel>. Expanding the tree allows
you to browse the class or entity structure, as well as view the relationships.
+ </para>
+ <figure>
+ <title>Hibernate Console Perspective</title>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata align="center" scale="80"
fileref="images/plugins/plugins_17.png"/>
+ </imageobject>
+ <imageobject role="html">
+ <imagedata align="center"
fileref="images/plugins/plugins_17.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ The <guilabel>Console Configuration</guilabel> does not dynamically
adjust to changes performed in mappings and Java code. To reload the configuration select
the configuration and click the <guibutton>Reload</guibutton> button in the
view toolbar or in the context menu.
+ </para>
+ <para>
+ It is possible to open source and mapping files for objects showed in the
<guilabel>Hibernate Configurations View</guilabel>. Just bring up the context
menu for an object and select <guimenuitem>Open Source File</guimenuitem> to
see the appropriate Java class or <guimenuitem>Open Mapping File</guimenuitem>
to open a <filename>.hbm.xml</filename> file.
+ </para>
+ <figure>
+ <title>Opening Source for Objects</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/plugins_17_a.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <section id="map_diagram">
+ <title>Mapping Diagram</title>
+ <para>
+ In order to visualize how entities are related, as well as view their structures, a
<guilabel>Mapping Diagram</guilabel> is provided. It is available by right
clicking on the entity you want view a mapping diagram for and then selecting
<guilabel>Mapping Diagram</guilabel>.
+ </para>
+ <figure>
+ <title>Mapping Diagram</title>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata align="center" scale="80"
fileref="images/plugins/plugins_18.png"/>
+ </imageobject>
+ <imageobject role="html">
+ <imagedata align="center"
fileref="images/plugins/plugins_18.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ To make <guilabel>Mapping Diagram</guilabel> usage easier you can use
the <guilabel>Rules</guilabel>, <guilabel>Grid</guilabel>,
<guilabel>Snap to Geometry</guilabel> checkboxes in the
<guimenu>View</guimenu> menu.
+ </para>
+ <figure>
+ <title>View menu</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/map_diagram1.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ If you select the <guilabel>Rulers</guilabel> checkbox, the view print
page scale will be added to the page. The numbers on the scale displays its size in
inches. If you click on the scale a <guilabel>Ruler Guide</guilabel> will
appear on the diagram. You can connect any diagram item to it. To connect the items you
should move their tops to the Ruler Guide. And while moving the ruler guide, the items
will be moved together with it as a whole.
+ </para>
+ <figure>
+ <title>Moving the Ruler guide</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/map_diagram2.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>If you select the <guilabel>Grid</guilabel> checkbox, a grid
will appear on the diagram.</para>
+ <figure>
+ <title>Grid on Mapping diagram</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/map_diagram3.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>The <guilabel>Snap to Geometry</guilabel> checkbox allows you
to align the diagram items with the grid.</para>
+ <para>
+ For better navigating through the diagram use the <guilabel>Outline
view</guilabel>, which is available in the structural and graphical modes.
+ </para>
+ <figure>
+ <title>Navigating in the Structural Mode</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/plugins_18_a.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>To switch between the view modes, use the buttons in the top-right corner
of the <guilabel>Outline view</guilabel>.</para>
+ <figure>
+ <title>Navigating in the Graphical Mode</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/plugins_18_b.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>The options in the context menu of the mapping diagram are listed in the
next table.</para>
+ <table>
+ <title>Context Menu Options of the Mapping Diagram</title>
+ <tgroup cols="3">
+ <colspec colnum="1" align="left"
colwidth="1*"/>
+ <colspec colnum="2" align="left"
colwidth="1*"/>
+ <colspec colnum="3" align="left"
colwidth="3*"/>
+ <thead>
+ <row>
+ <entry align="center">
+ <para>Icon</para>
+ </entry>
+ <entry align="center">
+ <para>Command</para>
+ </entry>
+ <entry align="center">
+ <para>Description</para>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/toggleConnections.png"/>
+ </imageobject>
+ </inlinemediaobject>
+ </para>
+ </entry>
+ <entry>
+ <para>Show|Hide connections</para>
+ </entry>
+ <entry>Allows you to select what types of connections should be shown on
the diagram: <itemizedlist>
<listitem>
<para>Property Mappings</para>
- </listitem>
- <listitem>
- <para>Class Mappings</para>
- </listitem>
- <listitem>
- <para>Associations</para>
- </listitem>
- <listitem>
- <para>Foreign key constraints</para>
- </listitem>
- </itemizedlist></entry>
- </row>
- <row>
- <entry>
- <para/>
- </entry>
- <entry>
- <para>Select All</para>
- </entry>
- <entry>
- <para>Makes all the diagram elements selected</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>
- <inlinemediaobject>
- <imageobject>
- <imagedata
fileref="images/plugins/autoLayout.png"/>
- </imageobject>
- </inlinemediaobject>
- </para>
- </entry>
- <entry>
- <para>Auto layout</para>
- </entry>
- <entry>
- <para>Used to dispose all the items of the diagram in a standard
manner</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>
- <inlinemediaobject>
- <imageobject>
- <imagedata
fileref="images/plugins/exportAsImage.png"/>
- </imageobject>
- </inlinemediaobject>
- </para>
- </entry>
- <entry>
- <para>Export as Image</para>
- </entry>
- <entry>
- <para>Allows to export a diagram as
<emphasis><property>.png
- </property>,</emphasis>
- <emphasis>
- <property>.jpeg</property>
- </emphasis> or <emphasis>
- <property>.bmp </property>
- </emphasis></para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <para>When you open the context menu while clicking an item on the diagram,
it quite differs
- from the one described before.</para>
- <figure>
- <title>Context Menu in Mapping Item</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/plugins_18_g.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>The next table describes all the extra options in the menu of mapping
items:</para>
- <table>
- <title>Extra Options in the Context Menu of Mapping Item</title>
- <tgroup cols="3">
- <colspec colnum="1" align="left"
colwidth="1*"/>
- <colspec colnum="2" align="left"
colwidth="1*"/>
- <colspec colnum="3" align="left"
colwidth="3*"/>
- <thead>
- <row>
- <entry align="center">
- <para>Icon</para>
- </entry>
- <entry align="center">
- <para>Command</para>
- </entry>
- <entry align="center">
- <para>Description</para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- <inlinemediaobject>
- <imageobject>
- <imagedata
fileref="images/plugins/openSourceFile_but.png"/>
- </imageobject>
- </inlinemediaobject>
- </para>
- </entry>
- <entry>
- <para>Open Source File</para>
- </entry>
- <entry>
- <para>Makes it possible to open a source file for a chosen
object/element. The
- selected element will be highlighted in the open file.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>
- <inlinemediaobject>
- <imageobject>
- <imagedata
fileref="images/plugins/openMappingFile_but.png"/>
- </imageobject>
- </inlinemediaobject>
- </para>
- </entry>
- <entry>
- <para>Open Mapping File</para>
- </entry>
- <entry>
- <para>Makes it possible to open a mapping file for a chosen
object/element. The
- selected element will be highlighted in the open file.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>
- <inlinemediaobject>
- <imageobject>
- <imagedata
fileref="images/plugins/visibleState.png"/>
- </imageobject>
- </inlinemediaobject>
- </para>
- </entry>
- <entry>
- <para>Show|Hide shape(s)</para>
- </entry>
- <entry>
- <para>Used to hide/show an item on the mapping
diagram</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>
- <inlinemediaobject>
- <imageobject>
- <imagedata
fileref="images/plugins/expandState.png"/>
- </imageobject>
- </inlinemediaobject>
- </para>
- </entry>
- <entry>
- <para>Expand|Collapse shape(s)</para>
- </entry>
- <entry>
- <para>Used for expanding/collapsing fields of the
item</para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <note>
- <title>Tip:</title>
- <para>All the described types of the context menu are also available in
the <property
- >Outline</property> view.</para>
- </note>
- <para>The below table lists the actions that could be performed using the
keyboard keys (or
- keys combinations).</para>
- <table>
- <title>Hibernate Mapping Diagram Shortcut Keys</title>
- <tgroup cols="2">
- <colspec colnum="1" align="left"
colwidth="3*"/>
- <colspec colnum="2" align="left"
colwidth="1*"/>
- <thead>
- <row>
- <entry align="center">
- <para>Command</para>
- </entry>
- <entry align="center">
- <para>Binding</para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>Scroll the diagram content</para>
- </entry>
- <entry>
- <para>Ctrl + Shift + arrows</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Collapse/Expand selected item(s)</para>
- </entry>
- <entry>
- <para> Enter </para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Show/Hide selected item(s)</para>
- </entry>
- <entry>
- <para> + </para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Sort items in alphabetical order or return the initial
state</para>
- </entry>
- <entry>
- <para>Space</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Navigate between the items</para>
- </entry>
- <entry>
- <para>Arrows</para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <para>It's possible to save the diagram in the eclipse workspace.
Click the usual
- <emphasis>
- <property>File > Save As</property>
- </emphasis> option, the wizard will ask you to set the location within
you project where
- to save the file and give the name for the diagram. The item's names
concatenated
- with the ampersand symbols are set as the default name for a diagram. The file
is saved
- with the <literal>.hibernate</literal> extension.</para>
- <figure>
- <title>The Diagram saved in the Workspace</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/saveDiagram.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <note>
- <title>Note:</title>
- <para>If you restart the Eclipse with the mapping diagram opened, the
mapping diagram will
- be restored with the message like on the figure below. To view the diagram
content, you
- should perform the refreshing.</para>
- </note>
- <figure>
- <title>The Diagram after Restarting the Eclipse</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/diagram1.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <figure>
- <title>The Diagram after Refreshing</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/diagram2.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>There are some useful commands in the toolbar.</para>
- <figure>
- <title>The Diagram View Toolbar</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/diagramToolbar.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>They are described in the table below.</para>
- <table>
- <title>Command in Diagram View Toolbar </title>
- <tgroup cols="3">
- <colspec colnum="1" align="left"
colwidth="1*"/>
- <colspec colnum="2" align="left"
colwidth="1*"/>
- <colspec colnum="3" align="left"
colwidth="3*"/>
- <thead>
- <row>
- <entry align="center">
- <para>Icon</para>
- </entry>
- <entry align="center">
- <para>Command</para>
- </entry>
- <entry align="center">
- <para>Description</para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- <inlinemediaobject>
- <imageobject>
- <imagedata
fileref="images/plugins/toolbarRefresh.png"/>
- </imageobject>
- </inlinemediaobject>
- </para>
- </entry>
- <entry>
- <para>Refresh Visual Mapping</para>
- </entry>
- <entry>
- <para>It update <property>Mapping Diagram</property>
if <property>Console
- Configuration</property> was changed. </para>
- </entry>
- </row>
- <row>
- <entry>
- <para>
- <inlinemediaobject>
- <imageobject>
- <imagedata
fileref="images/plugins/toolbarZoom.png"/>
- </imageobject>
- </inlinemediaobject>
- </para>
- </entry>
- <entry>
- <para>Zoom Box</para>
- </entry>
- <entry>
- <para>Used to define scale of the diagram. Also it's used for
<property>Mapping
- Diagram</property> printing. If you want to put the whole
<property
- >diagram</property> to one print page, you need select
<property
- >Page</property> option in the <property>Zoom
Box</property>.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>
- <inlinemediaobject>
- <imageobject>
- <imagedata
fileref="images/plugins/toolbarAutolayout.png"/>
- </imageobject>
- </inlinemediaobject>
- </para>
- </entry>
- <entry>
- <para>Auto layout</para>
- </entry>
- <entry>
- <para>Used to arrange all diagram items in a standard
manner.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>
- <inlinemediaobject>
- <imageobject>
- <imagedata
fileref="images/plugins/toolbarShowHideConnections.png"/>
- </imageobject>
- </inlinemediaobject>
- </para>
- </entry>
- <entry>
- <para>Show|Hide connections</para>
- </entry>
- <entry>
- <para>Used to show or hide connection on the diagram. Moreover
you can choose what
- type of connections must be present on the diagram
(<property>Property
- Mappings</property>, <property>Class
Mappings</property>, <property
- >Associations</property> or <property>Foreign key
constraints</property>)
- .</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>
- <inlinemediaobject>
- <imageobject>
- <imagedata
fileref="images/plugins/toolbarExpandCollapse.png"/>
- </imageobject>
- </inlinemediaobject>
- </para>
- </entry>
- <entry>
- <para>Expand|Collapse</para>
- </entry>
- <entry>
- <para>Used for expanding/collapsing fields of the
item.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>
- <inlinemediaobject>
- <imageobject>
- <imagedata
fileref="images/plugins/toolbarShowHideShapes.png"/>
- </imageobject>
- </inlinemediaobject>
- </para>
- </entry>
- <entry>
- <para> Show|Hide shape(s)</para>
- </entry>
- <entry>
- <para>Used to hide/show an item on the mapping
diagram.</para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </section>
- </section>
- <section>
- <title>Prototyping Queries</title>
- <para>Queries can be prototyped by entering them into the
<property>HQL</property> or
- <property>Criteria Editor</property>. To execute a query you should
click the green run
- button in the editor toolbar or press <emphasis>
- <property>Ctrl+Enter</property>
- </emphasis>.</para>
- <section id="hql_and_criteria_editors">
- <title>HQL Editor and Hibernate Criteria Editor</title>
- <para>To open the query editors right-click your project
<property>Console
- Configuration</property> and select <property>HQL
Editor</property> (or <property
- >Hibernate Criteria Editor</property>).</para>
- <figure>
- <title>Opening HQL Editor</title>
- <mediaobject>
- <imageobject>
- <imagedata
fileref="images/plugins/prototypingQueries.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <note>
- <title>Tip:</title>
- <para>If the context menu items are disabled then you need at first to
create a <property
- >Session Factory</property>. That is done by simply expanding the
<property>Session
- Factory</property> node.</para>
- </note>
- <para>When open the editors they should automatically detect the chosen
Console
- Configuration.</para>
- <para>To get a prefill query for any entity (or any entity child node)
listed in the
- <emphasis>
- <property>Session Factory</property>
- </emphasis> you should double-click it. This will open the
<property>HQL Editor</property>
- with the associated query.</para>
- <para>Choosing <emphasis>
- <property>HQL Editor</property>
- </emphasis> in the context menu for any entity (or any entity child node)
will also open
- the HQL editor with the associated query. If you choose <emphasis>
- <property>Hibernate Criteria Editor</property>
- </emphasis> in the context menu, it will open <property>Hibernate
Criteria
- Editor</property> with the associated criteria.</para>
- <figure>
- <title>Generating Simple Queries</title>
- <mediaobject>
- <imageobject role="fo">
- <imagedata align="center" scale="80"
fileref="images/plugins/plugins_19.png"
- format="PNG"/>
- </imageobject>
- <imageobject role="html">
- <imagedata align="center"
fileref="images/plugins/plugins_19.png" format="PNG"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>It's also possible to copy a portion of code from
<emphasis>
- <property>.java</property>
- </emphasis> file into the <property>HQL</property> or
<property>Criteria
- editor</property>. To do this make use of the Quick Fix option
(<emphasis>
- <property>Ctrl + 1</property>)</emphasis>.</para>
- <figure>
- <title>Quick Fix Option Demonstration</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/plugins_19_b.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>You can also update the original java code according to changes in
the HQL or Criteria
- editor. For that you should save your HQL/Criteria query and submit the
replacing in
- appeared confirmation dialog.</para>
- <figure>
- <title>Updating Java Code</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/plugins_19_c.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>Also you can pin <property>HQL editor</property> and
<property>Criteria
- editor</property> for one tab in <property>Hibernate Query
Result</property> view. For
- that you need click on <property>Stick result to one
tab</property>
- button(<inlinemediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/sticky_but.png"/>
- </imageobject>
- </inlinemediaobject> ). In the issue query executions results will be
shown in one tab (no
- more will be opened). </para>
- <para> Moreover you are able to rename tab in <property>Hibernate
Query Result</property>.
- Click the tab, and type a new name in <property>Property View->Tab
name field</property>. </para>
- <figure>
- <title>Tab Renaming</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/plugins_19_d.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- </section>
- <section>
- <title>Error Handling</title>
- <para>Errors during creation of the <property>Session
Factory</property> or running the
- queries (e.g. if your configuration or query is incorrect) will be shown in a
message
- dialog or inclined in the view that detected the error, you may get more
information about
- the error in the <property>Error Log View</property> on the right
pane.</para>
- <para>Results of a query will be shown in the <property>Hibernate
Query Result
- View</property> and details of possible errors (syntax errors, database
errors, etc.)
- can be seen in the <property>Error Log
View</property>.</para>
- <note>
- <title>Note:</title>
- <para>HQL queries are executed by default using
<literal>list()</literal> thus without any
- limit of the size of the output the query could return a large result set.
You might run
- out of memory. To avoid this you can put a value in the Max results field to
reduce the
- number of elements returned.</para>
- </note>
- </section>
- <section>
- <title>Dynamic Query Translator</title>
- <para>If the <property>Hibernate Dynamic Query Translator
View</property> is visible while
- writing in the <property>HQL Editor</property> it will show the
generated SQL for a HQL
- query.</para>
- <figure>
- <title>Hibernate Dynamic Query Translator View</title>
- <mediaobject>
- <imageobject role="fo">
- <imagedata align="center" scale="80"
fileref="images/plugins/plugins_20.png"
- format="PNG"/>
- </imageobject>
- <imageobject role="html">
- <imagedata align="center"
fileref="images/plugins/plugins_20.png" format="PNG"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>The translation is done each time you stop typing into the editor, if
there are errors
- in the HQL the parse exception will be shown embedded in the
view.</para>
- </section>
- </section>
- <section>
- <title>Properties View</title>
- <para>As you can see on the figure,when clicking on class/entity
<property>Properties
- view</property> shows the number of query results as well as the time of
executing.</para>
- <figure>
- <title>Properties View</title>
- <mediaobject>
- <imageobject role="fo">
- <imagedata align="center" scale="80"
fileref="images/plugins/plugins_21_a.png"
- format="PNG"/>
- </imageobject>
- <imageobject role="html">
- <imagedata align="center"
fileref="images/plugins/plugins_21_a.png" format="PNG"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>It also displays the structure of any persistent object selected in the
<property
- >Hibernate Query Results View</property>. Editing is not yet
supported.</para>
- <figure>
- <title>Properties View for Selected Object</title>
- <mediaobject>
- <imageobject role="fo">
- <imagedata align="center" scale="80"
fileref="images/plugins/plugins_21_b.png"
- format="PNG"/>
- </imageobject>
- <imageobject role="html">
- <imagedata align="center"
fileref="images/plugins/plugins_21_b.png" format="PNG"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>You can also use <property>Properties view</property> when
clicking on the configuration
- itself in Hibernate Configuration View( <xref
linkend="modif_console_conf"/>). </para>
- </section>
- </section>
- <section id="jpa_annotations">
- <title>Hibernate:add JPA annotations refactoring </title>
- <para>Using this wizard you can add the next Hibernate annotations to the
class: <emphasis>
- <property>@Column</property>
- </emphasis>,<emphasis>
- <property>@Entity</property>
- </emphasis>,<emphasis>
- <property>@ManyToOne</property>
- </emphasis>,<emphasis>
- <property>@OneToMany</property>
- </emphasis>,<emphasis>
- <property>@OneToOne</property>
- </emphasis>,<emphasis>
- <property>@ManyToMany</property>
- </emphasis>,<emphasis>
- <property>@MappedSuperclass</property>
- </emphasis>,<emphasis>
- <property>@Id</property>
- </emphasis>,<emphasis>
- <property>@GeneratedValue</property>
- </emphasis> ,<emphasis>
- <property>@Version </property>
- </emphasis>
+ </listitem>
+ <listitem>
+ <para>Class Mappings</para>
+ </listitem>
+ <listitem>
+ <para>Associations</para>
+ </listitem>
+ <listitem>
+ <para>Foreign key constraints</para>
+ </listitem>
+ </itemizedlist>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para/>
+ </entry>
+ <entry>
+ <para>Select All</para>
+ </entry>
+ <entry>
+ <para>Selects all the diagram elements</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/autoLayout.png"/>
+ </imageobject>
+ </inlinemediaobject>
+ </para>
+ </entry>
+ <entry>
+ <para>Auto layout</para>
+ </entry>
+ <entry>
+ <para>Used to dispose all the items in the diagram in a standard
manner</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/exportAsImage.png"/>
+ </imageobject>
+ </inlinemediaobject>
+ </para>
+ </entry>
+ <entry>
+ <para>Export as Image</para>
+ </entry>
+ <entry>
+ <para>
+ Allows the diagram to be exported as a
<filename>PNG</filename>,<filename>JPEG</filename> or
<filename>BMP</filename> file
+ </para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <para>When you open the context menu for an item in the diagram, it differs
quite significantly from the one described before.</para>
+ <figure>
+ <title>Context Menu in Mapping Item</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/plugins_18_g.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>The next table describes the additional options found in the mapping
items context menu:</para>
+ <table>
+ <title>Extra Options in the Context Menu of Mapping Item</title>
+ <tgroup cols="3">
+ <colspec colnum="1" align="left"
colwidth="1*"/>
+ <colspec colnum="2" align="left"
colwidth="1*"/>
+ <colspec colnum="3" align="left"
colwidth="3*"/>
+ <thead>
+ <row>
+ <entry align="center">
+ <para>Icon</para>
+ </entry>
+ <entry align="center">
+ <para>Command</para>
+ </entry>
+ <entry align="center">
+ <para>Description</para>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/openSourceFile_but.png"/>
+ </imageobject>
+ </inlinemediaobject>
+ </para>
+ </entry>
+ <entry>
+ <para>Open Source File</para>
+ </entry>
+ <entry>
+ <para>
+ Opens the source file for a chosen object or element. The selected element will
be highlighted in the open file.
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata
fileref="images/plugins/openMappingFile_but.png"/>
+ </imageobject>
+ </inlinemediaobject>
+ </para>
+ </entry>
+ <entry>
+ <para>Open Mapping File</para>
+ </entry>
+ <entry>
+ <para>
+ Opens a mapping file for a chosen object or element. The selected element will
be highlighted in the open file.
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/visibleState.png"/>
+ </imageobject>
+ </inlinemediaobject>
+ </para>
+ </entry>
+ <entry>
+ <para>Show|Hide shape(s)</para>
+ </entry>
+ <entry>
+ <para>Used to hide or show an item on the mapping diagram</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/expandState.png"/>
+ </imageobject>
+ </inlinemediaobject>
+ </para>
+ </entry>
+ <entry>
+ <para>Expand|Collapse shape(s)</para>
+ </entry>
+ <entry>
+ <para>Used to expand and collapse fields displayed by the
item</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <note>
+ <title>Tip:</title>
+ <para>All these context menu options are also available in the
<guilabel>Outline</guilabel> view.</para>
+ </note>
+ <para>The following table lists the available keyboard shortcuts.</para>
+ <table>
+ <title>Hibernate Mapping Diagram Shortcut Keys</title>
+ <tgroup cols="2">
+ <colspec colnum="1" align="left"
colwidth="3*"/>
+ <colspec colnum="2" align="left"
colwidth="1*"/>
+ <thead>
+ <row>
+ <entry align="center">
+ <para>Command</para>
+ </entry>
+ <entry align="center">
+ <para>Binding</para>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para>Scroll the diagram content</para>
+ </entry>
+ <entry>
+ <para>
+ <keycombo>
+ <keycap>Ctrl</keycap>
+ <keycap>Shift</keycap>
+ <keycap>arrows</keycap>
+ </keycombo>
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Collapse or Expand selected item(s)</para>
+ </entry>
+ <entry>
+ <para>
+ <keycap>Enter</keycap>
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Show or Hide selected item(s)</para>
+ </entry>
+ <entry>
+ <para>
+ <keycap>+</keycap>
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Sort items in alphabetical order or return to the initial
state</para>
+ </entry>
+ <entry>
+ <para>
+ <keycap>Space</keycap>
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Navigate between the items</para>
+ </entry>
+ <entry>
+ <para>
+ <keycap>Arrows</keycap>
+ </para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <para>
+ It is possible to save the diagram in the Eclipse workspace. Select
<menuchoice><guimenuitem>File</guimenuitem><guimenuitem>Save
As</guimenuitem></menuchoice>, and the wizard will ask you to specify the
location within you project where you wish to save the file, and provide the name for the
diagram. The default name is the item's names concatenated with the ampersand
symbols. The file is saved with the <filename>.hibernate</filename>
extension.
+ </para>
+ <figure>
+ <title>The Diagram saved in the Workspace</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/saveDiagram.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <note>
+ <title>Note:</title>
+ <para>
+ If you restart Eclipse with the mapping diagram opened, the mapping diagram will be
restored with the message like on the figure below. To view the diagram content, you
should refresh the view.
+ </para>
+ </note>
+ <figure>
+ <title>The Diagram after Restarting the Eclipse</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/diagram1.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <figure>
+ <title>The Diagram after Refreshing</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/diagram2.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>There are some useful commands in the toolbar.</para>
+ <figure>
+ <title>The Diagram View Toolbar</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/diagramToolbar.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>They are described in the table below.</para>
+ <table>
+ <title>Command in Diagram View Toolbar </title>
+ <tgroup cols="3">
+ <colspec colnum="1" align="left"
colwidth="1*"/>
+ <colspec colnum="2" align="left"
colwidth="1*"/>
+ <colspec colnum="3" align="left"
colwidth="3*"/>
+ <thead>
+ <row>
+ <entry align="center">
+ <para>Icon</para>
+ </entry>
+ <entry align="center">
+ <para>Command</para>
+ </entry>
+ <entry align="center">
+ <para>Description</para>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/toolbarRefresh.png"/>
+ </imageobject>
+ </inlinemediaobject>
+ </para>
+ </entry>
+ <entry>
+ <para>Refresh Visual Mapping</para>
+ </entry>
+ <entry>
+ <para>It will update the <guilabel>Mapping Diagram</guilabel>
the if <guilabel>Console Configuration</guilabel> was changed. </para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/toolbarZoom.png"/>
+ </imageobject>
+ </inlinemediaobject>
+ </para>
+ </entry>
+ <entry>
+ <para>Zoom Box</para>
+ </entry>
+ <entry>
+ <para>
+ Used to define scale of the diagram. It is also used for printing
<guilabel>Mapping Diagrams</guilabel>. If you want to print the whole
<guilabel>diagram</guilabel> to one page, you need select the
<guilabel>Page</guilabel> option in the <guilabel>Zoom
Box</guilabel> drop down list.
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/toolbarAutolayout.png"/>
+ </imageobject>
+ </inlinemediaobject>
+ </para>
+ </entry>
+ <entry>
+ <para>Auto layout</para>
+ </entry>
+ <entry>
+ <para>Used to arrange all diagram items in a standard
manner.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata
fileref="images/plugins/toolbarShowHideConnections.png"/>
+ </imageobject>
+ </inlinemediaobject>
+ </para>
+ </entry>
+ <entry>
+ <para>Show|Hide connections</para>
+ </entry>
+ <entry>
+ <para>
+ Used to show or hide a connection on the diagram. You can also choose what type
of connections must be present on the diagram (<guilabel>Property
Mappings</guilabel>, <guilabel>Class Mappings</guilabel>,
<guilabel>Associations</guilabel> or <guilabel>Foreign key
constraints</guilabel>).
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata
fileref="images/plugins/toolbarExpandCollapse.png"/>
+ </imageobject>
+ </inlinemediaobject>
+ </para>
+ </entry>
+ <entry>
+ <para>Expand|Collapse</para>
+ </entry>
+ <entry>
+ <para>Used for expanding or collapsing fields of the item.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata
fileref="images/plugins/toolbarShowHideShapes.png"/>
+ </imageobject>
+ </inlinemediaobject>
+ </para>
+ </entry>
+ <entry>
+ <para> Show|Hide shape(s)</para>
+ </entry>
+ <entry>
+ <para>Used to hide or show an item on the mapping diagram.</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
+ </section>
+ <section>
+ <title>Prototyping Queries</title>
+ <para>
+ Queries can be prototyped by entering them into the
<guilabel>HQL</guilabel> or <guilabel>Criteria Editor</guilabel>.
To execute a query click the green run button in the editor toolbar, or press
<keycombo><keycap>Ctrl</keycap><keycap>Enter</keycap></keycombo>.
+ </para>
+ <section id="hql_and_criteria_editors">
+ <title>HQL Editor and Hibernate Criteria Editor</title>
+ <para>
+ To open the query editors right-click your projects <guilabel>Console
Configuration</guilabel> and select <guimenuitem>HQL
Editor</guimenuitem> (or <guimenuitem>Hibernate Criteria
Editor</guimenuitem>).
+ </para>
+ <figure>
+ <title>Opening HQL Editor</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/prototypingQueries.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <note>
+ <title>Tip:</title>
+ <para>
+ If the context menu items are disabled then you need at first to create a
<guilabel>Session Factory</guilabel>. That is done by expanding the
<guilabel>Session Factory</guilabel> node.
+ </para>
+ </note>
+ <para>When they are opened, the editors they should automatically detect the
chosen <guilabel>Console Configuration</guilabel>.</para>
+ <para>
+ To generate a predefined query for any entity (or any entity child node) listed in
the <guilabel>Session Factory</guilabel> you should double-click it. This will
open the <guilabel>HQL Editor</guilabel> with the associated query.
+ </para>
+ <para>
+ Choosing <guimenuitem>HQL Editor</guimenuitem> in the context menu for
any entity (or any entity child node) will also open the HQL Editor with the associated
query. If you select <guimenuitem>Hibernate Criteria Editor</guimenuitem> in
the context menu, it will open <guilabel>Hibernate Criteria Editor</guilabel>
with the associated criteria.
+ </para>
+ <figure>
+ <title>Generating Simple Queries</title>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata align="center" scale="80"
fileref="images/plugins/plugins_19.png" format="PNG"/>
+ </imageobject>
+ <imageobject role="html">
+ <imagedata align="center"
fileref="images/plugins/plugins_19.png" format="PNG"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ It is also possible to copy a portion of code from a
<filename>.java</filename> file into the <guilabel>HQL</guilabel>
or <guilabel>Criteria editor</guilabel>. To do this make use of the Quick Fix
option
(<keycombo><keycap>Ctrl</keycap><keycap>1</keycap></keycombo>).
+ </para>
+ <figure>
+ <title>Quick Fix Option Demonstration</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/plugins_19_b.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ You can also update the original Java code with changes made in the HQL or Criteria
editor. For that you should save your HQL/Criteria query and submit the replacement code
when prompted by the confirmation dialog.
+ </para>
+ <figure>
+ <title>Updating Java Code</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/plugins_19_c.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ In addition, you can pin the <guilabel>HQL editor</guilabel> and
<guilabel>Criteria editor</guilabel> as a tab in the <guilabel>Hibernate
Query Result</guilabel> view. For that you need click on the <guibutton>Stick
result to one tab</guibutton> button
(<inlinemediaobject><imageobject><imagedata
fileref="images/plugins/sticky_but.png"/></imageobject></inlinemediaobject>).
In this state query executions results will be shown in one tab (no more will be opened).
+ </para>
+ <para>
+ You are able to rename the <guilabel>Hibernate Query Result</guilabel>
tab. Click the tab, and type a new name in the
<menuchoice><guimenuitem>Property
View</guimenuitem><guimenuitem>Tab name</guimenuitem></menuchoice>
field.
+ </para>
+ <figure>
+ <title>Tab Renaming</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/plugins_19_d.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </section>
+ <section>
+ <title>Error Handling</title>
+ <para>
+ Errors raised during the creation of the <guilabel>Session
Factory</guilabel>, or when executing the queries (e.g. if your configuration or
query is incorrect), will be shown in a message dialog or inclined in the view that
detected the error. You may get more information about the error in the
<guilabel>Error Log</guilabel> view on the right pane.
+ </para>
+ <para>
+ Results of a query will be shown in the <guilabel>Hibernate Query
Result</guilabel> view and details of possible errors (syntax errors, database
errors, etc.) can be seen in the <guilabel>Error Log</guilabel> view.
+ </para>
+ <note>
+ <title>Note:</title>
+ <para>
+ HQL queries are executed by default using the <code>list()</code>
function, and without any row limit could return a large result set. You may run out of
memory. To avoid this you can enter a value in the <guilabel>Max</guilabel>
results field to reduce the number of elements that are returned.
+ </para>
+ </note>
+ </section>
+ <section>
+ <title>Dynamic Query Translator</title>
+ <para>
+ If the <guilabel>Hibernate Dynamic Query Translator</guilabel> view is
visible, it will show the generated SQL for a HQL query while you write in the
<guilabel>HQL Editor</guilabel> .
+ </para>
+ <figure>
+ <title>Hibernate Dynamic Query Translator View</title>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata align="center" scale="80"
fileref="images/plugins/plugins_20.png" format="PNG"/>
+ </imageobject>
+ <imageobject role="html">
+ <imagedata align="center"
fileref="images/plugins/plugins_20.png" format="PNG"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ The translation is performed each time you stop typing in the editor. If there are
errors in the HQL code the parse exception will be shown embedded in the view.
+ </para>
+ </section>
+ </section>
+ <section>
+ <title>Properties View</title>
+ <para>
+ As you can see in the figure below, when clicking on class or entity the
<guilabel>Properties</guilabel> view shows the number of query results as well
as the execution time.
+ </para>
+ <figure>
+ <title>Properties View</title>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata align="center" scale="80"
fileref="images/plugins/plugins_21_a.png" format="PNG"/>
+ </imageobject>
+ <imageobject role="html">
+ <imagedata align="center"
fileref="images/plugins/plugins_21_a.png" format="PNG"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ It also displays the structure of any persistent object selected in the
<guilabel>Hibernate Query Results View</guilabel>. Editing is not yet
supported.
+ </para>
+ <figure>
+ <title>Properties View for Selected Object</title>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata align="center" scale="80"
fileref="images/plugins/plugins_21_b.png" format="PNG"/>
+ </imageobject>
+ <imageobject role="html">
+ <imagedata align="center"
fileref="images/plugins/plugins_21_b.png" format="PNG"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ You can also use <guilabel>Properties</guilabel> view when clicking on
the configuration itself in <guilabel>Hibernate Configuration</guilabel> view
(see <xref linkend="modif_console_conf"/>).
+ </para>
+ </section>
+ </section>
+ <section id="jpa_annotations">
+ <title>Hibernate:add JPA annotations refactoring </title>
+ <para>Using this wizard you can add the following Hibernate annotations to a
class: <code>@Column</code>, <code>@Entity</code>,
<code>@ManyToOne</code>, <code>@OneToMany</code>,
<code>@OneToOne</code>, <code>@ManyToMany</code>,
<code>@MappedSuperclass</code>, <code>@Id</code>,
<code>@GeneratedValue</code>, <code>@Version </code>
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para><code>@Column</code> is added to all String
properties.</para>
+ </listitem>
+ <listitem>
+ <para>
+ <code>@Entity</code> is always declared before any class where it has
not yet been defined.</para>
+ </listitem>
+ <listitem>
+ <para>
+ <code>@ManyToOne</code>, <code>@OneToMany</code>,
<code>@OneToOne</code>, <code>@ManyToMany</code> - these
annotations are declared according to the classes hierarchy.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <code>@MappedSuperclass</code> is added to abstract
superclasses.</para>
+ </listitem>
+ <listitem>
+ <para>
+ <code>@Id</code>, <code>@GeneratedValue</code> are only
added automatically to the properties under the name "Id", where they have not
yet been defined.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <code>@Version</code> is declared in case you select optimistic locking
(see <xref linkend="optim_lock"/>).</para>
+ </listitem>
+ </itemizedlist>
+ <note>
+ <title>Note:</title>
+ <para>
+ This section doesn't cover the definitions of the <property>Hibernate
annotations</property>. For more information read the <ulink
url="http://docs.jboss.org/hibernate/stable/annotations/reference/en...
Annotations Documentation</ulink>.
+ </para>
+ </note>
+ <para>
+ To open this wizard you should right click the class you want to add the annotations
to and select
<menuchoice><guimenuitem>Source</guimenuitem><guimenuitem>Generate
Hibernate/JPA annotations</guimenuitem></menuchoice> from the context menu.
You will see the <guilabel>Hibernate: add JPA annotations</guilabel> dialog.
+ </para>
+ <figure>
+ <title>Starting Hibernate:add JPA annotations dialog</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/annotations1.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ The top section of this dialog lists all the classes that will be passed through
refactoring. Next to the class you have selected, this list also displays its superclasses
and the classes that the objects present in the current class as properties. If you want
to add new classes or packages to the list, you should click the
<guibutton>Back</guibutton> button. This will display the <guilabel>Add
classes and packages</guilabel> page.
+ </para>
+ <figure>
+ <title>Add classes and packages page </title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/annotations1_a.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ Here you can add additional classes or entire packages, and you can limit the
dependencies depth by selecting the <guilabel>depth control</guilabel> option
(you can find more information on this option in <xref
linkend="depth_control"/>). When you are finished click the
<guibutton>Next</guibutton> button and you will be returned to
<guilabel>The following classes will be changed</guilabel> page.</para>
+ <para>
+ By default the tags are added to the fields of selected classes. You can change this
option to <guilabel>Getters</guilabel> in the <guilabel>Preferred
location of Annotations</guilabel> drop down list, which results in the annotations
being added to the getter methods. If you choose <guilabel>Auto select from class
preference</guilabel> then the annotations are added according to the position of
the majority of the existing annotations.
+ </para>
+ <para>
+ If it is necessary to map your <code>String</code> properties to the
columns that length differ from the default value (255), change the
<guilabel>Default string length</guilabel> field and the
<code>@Column(length = your length)</code> annotation will be created for
every <code>String</code> property.
+ </para>
+ <para id="optim_lock">
+ You can add optimistic locking capabilities to an entity bean by selecting the
<guilabel>Enable optimistic locking</guilabel> checkbox. This operation will
add the version property to all the selected classes. The property will be also annotated
with <code>@Version</code>, and a getter and setter will be created. If the
property is already exists, it won't be created, but the getters and setters will be
generated. If there is already <code>@MappedSuperclass</code> annotation with
<code>@Version</code> in the base class of the current class,
<code>@Version</code> is not inserted into the current class.
</para>
- <itemizedlist>
- <listitem>
- <para><emphasis>
- <property>@Column</property>
- </emphasis> is added to all String properties.</para>
- </listitem>
- <listitem>
- <para><emphasis>
- <property>@Entity</property>
- </emphasis> is always declared before any class where it doesn't
present.</para>
- </listitem>
- <listitem>
- <para><emphasis>
- <property>@ManyToOne</property>
- </emphasis>,<emphasis>
- <property>@OneToMany</property>
- </emphasis>,<emphasis>
- <property>@OneToOne</property>
- </emphasis>,<emphasis>
- <property>@ManyToMany</property>
- </emphasis> - this annotations are declared according to the classes
hierarchy.</para>
- </listitem>
- <listitem>
- <para><emphasis>
- <property>@MappedSuperclass</property>
- </emphasis> is added to abstract superclasses.</para>
- </listitem>
- <listitem>
- <para><emphasis>
- <property>@Id</property>
- </emphasis>,<emphasis>
- <property>@GeneratedValue</property>
- </emphasis> are added automatically only to the properties under the name
"Id",where they
- don't present.</para>
- </listitem>
- <listitem>
- <para><emphasis>
- <property>@Version</property>
- </emphasis> is declared in case you select <xref
linkend="optim_lock"/>.</para>
- </listitem>
- </itemizedlist>
- <note>
- <title>Note:</title>
- <para>This section doesn't cover the meaning of the
<property>Hibernate annotations</property>
- , for more information read <ulink
-
url="http://docs.jboss.org/hibernate/stable/annotations/reference/en...
- Annotations Documentation</ulink> .</para>
- </note>
- <para>To open this wizard you should right click the class you want to enrich
with annotations
- <emphasis>
- <property>>Source>Generate Hibernate/JPA
annotations</property>
- </emphasis>. You will see the Hibernate:add JPA annotations dialog.
</para>
- <figure>
- <title>Starting Hibernate:add JPA annotations dialog</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/annotations1.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para> In the top of it you can see the list of all classes that will be passed
through
- refactoring. Besides the class you have selected in this list you can also find
its
- superclasses and the classes that objects present in the current class as
properties. If you
- want to add new classes or package to the list of classes, you should click the
<property
- >Back</property> button. In result you will see <property>Add
classes and
- packages</property> page.</para>
- <figure>
- <title>Add classes and packages page </title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/annotations1_a.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>Here you can add one more classes or whole package, moreover you can
limit dependencies
- depth by selecting <property>depth control</property> option (more
about this option you will
- find in <xref linkend="depth_control"/>). When finished
- just press the <property>Next</property> button and you will be
returned to <property>The
- following classes will be changed</property> page and will be able to
continue work with
- it.</para>
- <para>By default the tags are added to the fields of selected classes. But you
can change this
- option to <emphasis>
- <property>Getters</property>
- </emphasis>in <emphasis>
- <property> Preferred location of Annotations</property>
- </emphasis> dropdownlist and then all the annotations will be added to the
getter methods. If
- you choose <emphasis>
- <property>Auto select from class preference</property>
- </emphasis> then the annotations are added according to the majority of the
already existed
- ones positions. </para>
- <para> If it's nessecary to map your String properties to the columns that
length differ from
- the default value(255) ,change <emphasis>
- <property>Default string length field</property>
- </emphasis> and <code>@Column(length = your length)</code> will
be created before every String
- property. </para>
- <para id="optim_lock">You can add optimistic locking capability to an
entity bean by selecting
- <emphasis>
- <property>Enable optimistic locking</property>
- </emphasis> checkbox. This operation will add version property to all the
selected classes.
- The property will be also annotated with @Version ,getter and setter will be
created. If the
- property is already exists,it won't be created ,but the getters,setters will be
generated. If
- there is already @MappedSuperclass with version in the base class of the current
class -
- <emphasis>
- <property>"version"</property>
- </emphasis> is not inserted into the current class. </para>
- <para>After defining all necessary settings in the current step press
<emphasis>
- <property>Next</property>
- </emphasis> and follow the next wizard steps. </para>
- <figure>
- <title>Hibernate:add JPA annotations view</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/annotations2.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>The view represents two windows: one with the source code and and the
second with
- refactored one. With the help of <inlinemediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/butt1.png"/>
- </imageobject>
- </inlinemediaobject> ,<inlinemediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/butt2.png"/>
- </imageobject>
- </inlinemediaobject> ,<inlinemediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/butt3.png"/>
- </imageobject>
- </inlinemediaobject> ,<inlinemediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/butt4.png"/>
- </imageobject>
- </inlinemediaobject> buttons you can quickly navigate between the differences
in the code. If
- you don't agree with some changes you can't undo them but you can remove
the class from the
- list of classes that need refactoring. </para>
- <figure>
- <title>List of classes that need refactoring</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/annotations3.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>To apply the changes click <emphasis>
- <property>Finish</property>
- </emphasis>.</para>
- </section>
- <section id="debug_log">
- <title>Enable debug logging in the plugins</title>
- <para>It is possible to configure the eclipse plugin to route all logging made
by the plugins
- and hibernate code it self to the <property>Error Log View</property>
in Eclipse.</para>
- <para><property>Error Log View</property> is very useful tool to
solve any problem which appears
- in Hibernate Tools Plugins. You can use if there are troubles with setting up
<property
- >Hibernate Console Configuration</property>.</para>
- <para>This is done by editing the <emphasis>
- <property>hibernate-log4j.properties</property>
- </emphasis> in <emphasis>
- <property>org.hibernate.eclipse/ directory/jar</property>
- </emphasis>. This file includes a default configuration that only logs WARN
and above to a set
- of custom appenders (PluginFileAppender and PluginLogAppender). You can change
these settings
- to be as verbose or silent as you please - see <ulink
url="http://www.hibernate.org/5.html"
- >Hibernate Documentation</ulink> for interesting categories and Log4j
documentation.</para>
- <section>
- <title>Relevant Resources Links</title>
- <para>Find more on how to configure logging via a log4j property file in
<ulink
-
url="http://supportweb.cs.bham.ac.uk/docs/tutorials/docsystem/build/tutorials/log4j/log4j.html"
- >Log4j documentation</ulink>.</para>
- </section>
- </section>
- <section id="dali_integration">
- <title>Hibernate support for Dali plugins in Eclipse WTP</title>
- <para>Starting from 3.0.0 Alpha1 version of <property>JBoss
Tools</property> Hibernate plugins
- support Eclipse Dali integration what now makes it possible to use a Hibernate as a
complete
- JPA development platform.</para>
- <section id="jpa_project_with_hibernate">
- <title>Creating JPA project with Hibernate support</title>
- <para>When starting a new JPA project from <emphasis>
- <property>New > Other > JPA > JPA
Project</property>
- </emphasis> (or simply <emphasis>
- <property>New > JPA Project</property>
- </emphasis> in <property>JPA Perspective</property>), the first
wizard page looks as
- follows.</para>
- <figure>
- <title>Starting JPA Project</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/dali_integration1.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>It's possible here to select a target runtime and change the
project configuration,
- or you can leave everything as it is.</para>
- <para>On the JPA Facet page you should choose Hibernate as a target platform.
Also select the
- proper database connection, if it is defined, or add a new one by clicking the
<emphasis>
- <property>Add connection</property>
- </emphasis> link.</para>
- <para>Hitting <emphasis>
- <property>Finish</property>
- </emphasis> will generate the project.</para>
- <figure>
- <title>Targeting at Hibernate Platform</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/dali_integration2.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <note>
- <title>Note:</title>
- <para>Please note, if you choose Hibernate as a platform while creating a
JPA/Dali project,
- a Hibernate Console Configuration for the project is created automatically when
the wizard
- finishes its work. It allows a full usage of <property>Hibernate
Tools</property> features
- without additional setup.</para>
- </note>
- </section>
- <section id="generate_ddl_entities_with_hibernate">
- <title>Generating DDL and Entities</title>
- <para>By enabling Hibernate platform specific features you can now generate
DDL and Entities.
- For that find <emphasis>
- <property>JPA Tools > Generate Tables from Entities/Generate Entities
from
- Tables</property>
- </emphasis> options in the context menu of your JPA project.</para>
- <figure>
- <title>Generate DDL/Entities</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/dali_integration3.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <note>
- <title>Note:</title>
- <para>Please, remember to put the proper database driver to the classpath
of your
- project.</para>
- </note>
- <para>The <property>Generate Entities wizard</property> first
will ask you to choose the
- directory where all output will be written.</para>
- <figure>
- <title>Generate Entities Wizard</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/dali_integration4.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>To generate entities you can use:</para>
- <itemizedlist>
- <listitem>
- <para>a Hibernate Console Configuration (proposed by
default)</para>
- <para>Just make sure that the <emphasis>
- <property>Use Console Configuration</property>
- </emphasis> checkbox is selected and choose a needed configuration from
the <emphasis>
- <property>Console configurations</property>
- </emphasis> list box.</para>
- <figure>
- <title>Generate Entities Wizard</title>
- <mediaobject>
- <imageobject>
- <imagedata
fileref="images/plugins/dali_integration5.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- </listitem>
- </itemizedlist>
- <itemizedlist>
- <listitem>
- <para>or a DTP connection directly</para>
- <para>Just uncheck <emphasis>
- <property>Use Console Configuration</property>
- </emphasis> and adjust database settings.</para>
- </listitem>
- </itemizedlist>
- <para>All the same you do with Generate Entities Wizard you can do with
Generate DDL wizard.
- Special feature for Generate DDL wizard is possible automatic execution of
Generation DDL in
- the database. </para>
- <figure>
- <title>Generate DDL Wizard</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/dali_integration6.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>Thus, you can now have the Hibernate runtime support in Eclipse JPA
projects.</para>
- </section>
- <section id="hibernate_annotations_support">
- <title>Hibernate Annotations Support</title>
- <para>Also Hibernate Annotations are supported in <property>Dali Java
Persistence
- Tools</property>. The next annotations are integrated with
<property>JPA
- Details</property> view:</para>
- <itemizedlist>
- <listitem>
- <para>Id Generator annotations -
<property>@GenericGenerator</property> and <property
- >@GeneratedValue</property></para>
- <figure>
- <title>@GenericGenerator support in Dali</title>
- <mediaobject>
- <imageobject>
- <imagedata
fileref="images/plugins/dali_integration7.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <figure>
- <title>@GeneratedValue support in Dali</title>
- <mediaobject>
- <imageobject>
- <imagedata
fileref="images/plugins/dali_integration8.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- </listitem>
- <listitem>
- <para>Property annotations-
<property>@DiscriminatorFormula</property>, <property
- >@Generated Annotation</property>, <property>@Index
annotation</property></para>
- <figure>
- <title>@Index support in Dali</title>
- <mediaobject>
- <imageobject>
- <imagedata
fileref="images/plugins/dali_integration9.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- </listitem>
- <listitem>
- <para>Mapping Queries annotations -
<property>@NamedQuery</property> and <property
- >@NamedNativeQuery</property></para>
- <figure>
- <title>Add New Named Query Dialog with Hibernate Support</title>
- <mediaobject>
- <imageobject>
- <imagedata
fileref="images/plugins/dali_integration10.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <figure>
- <title>@NamedQuery support in Dali</title>
- <mediaobject>
- <imageobject>
- <imagedata
fileref="images/plugins/dali_integration11.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- </listitem>
- <listitem>
- <para>Association annotations in an
<property>embeddable</property> object (<property
- >@OneToOne</property>,
<property>@ManyToOne</property>, <property
- >@OneToMany</property> or
<property>@ManyToMany</property>)</para>
- <figure>
- <title>Hibernate Support for Embeddable Object</title>
- <mediaobject>
- <imageobject>
- <imagedata
fileref="images/plugins/dali_integration12.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- </listitem>
- </itemizedlist>
- <para>More information about Hibernate Annotation you can find in <ulink
-
url="http://docs.jboss.org/hibernate/stable/annotations/reference/en...
- Annotations Reference Guide</ulink>. </para>
- </section>
- <section>
- <title>Relevant Resources Links</title>
- <para>There is full information about native Dali plugin features on
<ulink
-
url="http://help.eclipse.org/galileo/index.jsp?nav=/8">Eclipse
Documentation
- page</ulink>.</para>
- </section>
- </section>
+ <para>After defining all the required settings click the
<guibutton>Next</guibutton> button.</para>
+ <figure>
+ <title>Hibernate:add JPA annotations view</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/annotations2.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ The view represents two windows: one with the source code and and the second with
refactored one. With the help of the
<inlinemediaobject><imageobject><imagedata
fileref="images/plugins/butt1.png"/></imageobject></inlinemediaobject>,
<inlinemediaobject><imageobject><imagedata
fileref="images/plugins/butt2.png"/></imageobject></inlinemediaobject>,
<inlinemediaobject><imageobject><imagedata
fileref="images/plugins/butt3.png"/></imageobject></inlinemediaobject>,
<inlinemediaobject><imageobject><imagedata
fileref="images/plugins/butt4.png"/></imageobject></inlinemediaobject>
buttons you can quickly navigate between the differences in the code. If you don't
agree with some changes you can't undo them but you can remove the class from the list
of classes that need refactoring.
+ </para>
+ <figure>
+ <title>List of classes that need refactoring</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/annotations3.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>To apply the changes click the <guibutton>Finish</guibutton>
button.</para>
+ </section>
+ <section id="debug_log">
+ <title>Enable debug logging in the plugins</title>
+ <para>
+ It is possible to configure the Eclipse plugin to route all logging performed by the
plugins and Hibernate code it self to the <guilabel>Error Log</guilabel> view
in Eclipse.
+ </para>
+ <para>
+ The <guilabel>Error Log</guilabel> view is very useful tool to use when
solving any problems which appear in the Hibernate Tools plugins. You can use it if there
are troubles setting up a <guilabel>Hibernate Console
Configuration</guilabel>.
+ </para>
+ <para>
+ This is done by editing the
<filename>hibernate-log4j.properties</filename> file in the
<filename>org.hibernate.eclipse/</filename> directory or JAR. This file
includes a default configuration that only logs WARN and above to a set of custom
appenders (PluginFileAppender and PluginLogAppender). You can change these settings to be
as verbose or silent as you please. See the <ulink
url="http://www.hibernate.org/5.html">Hibernate Documentation</ulink>
for more information on logging categories and Log4j documentation.
+ </para>
+ <section>
+ <title>Relevant Resources Links</title>
+ <para>
+ More information on how to to configure logging via a Log4j property file can be
found in the <ulink
url="http://supportweb.cs.bham.ac.uk/docs/tutorials/docsystem/build/tutorials/log4j/log4j.html">Log4j
documentation</ulink>.
+ </para>
+ </section>
+ </section>
+ <section id="dali_integration">
+ <title>Hibernate support for Dali plugins in Eclipse WTP</title>
+ <para>
+ Starting from version 3.0.0 Alpha1, <productname>JBoss Tools</productname>
Hibernate plugins support Eclipse Dali integration, which makes it possible to use a
Hibernate as a complete JPA development platform.
+ </para>
+ <section id="jpa_project_with_hibernate">
+ <title>Creating JPA project with Hibernate support</title>
+ <para>
+ When starting a new JPA project by selecting
<menuchoice><guimenuitem>New</guimenuitem><guimenuitem>Other</guimenuitem><guimenuitem>JPA</guimenuitem><guimenuitem>JPA
Project</guimenuitem></menuchoice> (or simply
<menuchoice><guimenuitem>New</guimenuitem><guimenuitem>JPA
Project</guimenuitem></menuchoice> in the <guilabel>JPA
Perspective</guilabel>), the first wizard page is shown in the image below.
+ </para>
+ <figure>
+ <title>Starting JPA Project</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/dali_integration1.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>You can select a target runtime and change the project configuration, or
you can leave everything as it is.</para>
+ <para>
+ On the JPA Facet page you should choose <guilabel>Hibernate</guilabel> as
a target platform. Also select the proper database connection, if it is defined, or add a
new one by clicking the <guilabel>Add connection</guilabel> link.
+ </para>
+ <para>Clicking the <guibutton>Finish</guibutton> button will
generate the project.</para>
+ <figure>
+ <title>Targeting at Hibernate Platform</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/dali_integration2.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <note>
+ <title>Note:</title>
+ <para>
+ If you choose Hibernate as a platform while creating a JPA/Dali project, a Hibernate
Console Configuration for the project is created automatically when the wizard is
finished. It allows all the <guilabel>Hibernate Tools</guilabel> features to
be used without any additional setup.
+ </para>
+ </note>
+ </section>
+ <section id="generate_ddl_entities_with_hibernate">
+ <title>Generating DDL and Entities</title>
+ <para>
+ By enabling Hibernate platform specific features you can now generate DDL and
Entities. To do that select the <menuchoice><guimenuitem>JPA
Tools</guimenuitem><guimenuitem>Generate Tables from Entities/Generate
Entities from Tables</guimenuitem></menuchoice> options in the context menu of
your JPA project.
+ </para>
+ <figure>
+ <title>Generate DDL/Entities</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/dali_integration3.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <note>
+ <title>Note:</title>
+ <para>Remember to put the appropriate database driver to the classpath of your
project.</para>
+ </note>
+ <para>The <guilabel>Generate Entities wizard</guilabel> will first
ask you to choose the directory where all output will be written.</para>
+ <figure>
+ <title>Generate Entities Wizard</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/dali_integration4.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>To generate entities you can use:</para>
+ <itemizedlist>
+ <listitem>
+ <para>A Hibernate Console Configuration (proposed by default)</para>
+ <para>
+ To select this option make sure that the <guilabel>Use Console
Configuration</guilabel> checkbox is selected and select a configuration from the
<guilabel>Console configurations</guilabel> list box.
+ </para>
+ <figure>
+ <title>Generate Entities Wizard</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/dali_integration5.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </listitem>
+ </itemizedlist>
+ <itemizedlist>
+ <listitem>
+ <para>Or a DTP connection directly</para>
+ <para>To select this option uncheck the <guilabel>Use Console
Configuration</guilabel> option and adjust the database settings.</para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ The options you define in the <guilabel>Generate Entities
Wizard</guilabel> can also be set with the <guilabel>Generate DDL
wizard</guilabel>. The <guilabel>Generate DDL</guilabel> wizard also
allows you automatically generate DDL for the database.
+ </para>
+ <figure>
+ <title>Generate DDL Wizard</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/dali_integration6.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>In this way you can enable Hibernate runtime support in Eclipse JPA
projects.</para>
+ </section>
+ <section id="hibernate_annotations_support">
+ <title>Hibernate Annotations Support</title>
+ <para>
+ Hibernate Annotations are also supported in <guilabel>Dali Java Persistence
Tools</guilabel>. The following annotations are integrated with the
<guilabel>JPA Details</guilabel> view:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>Id Generator annotations - <code>@GenericGenerator</code>
and <code>@GeneratedValue</code>
+ </para>
+ <figure>
+ <title>@GenericGenerator support in Dali</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/dali_integration7.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <figure>
+ <title>@GeneratedValue support in Dali</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/dali_integration8.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </listitem>
+ <listitem>
+ <para>Property annotations - <code>@DiscriminatorFormula</code>,
<code>@Generated</code>, <code>@Index</code>
+ </para>
+ <figure>
+ <title>@Index support in Dali</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/dali_integration9.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </listitem>
+ <listitem>
+ <para>Mapping Queries annotations - <code>@NamedQuery</code> and
<code>@NamedNativeQuery</code>
+ </para>
+ <figure>
+ <title>Add New Named Query Dialog with Hibernate Support</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/dali_integration10.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <figure>
+ <title>@NamedQuery support in Dali</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/dali_integration11.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </listitem>
+ <listitem>
+ <para>
+ Association annotations in an <property>embeddable</property> object
(<code>@OneToOne</code>, <code>@ManyToOne</code>,
<code>@OneToMany</code> or <code>@ManyToMany</code>)
+ </para>
+ <figure>
+ <title>Hibernate Support for Embeddable Object</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/dali_integration12.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </listitem>
+ </itemizedlist>
+ <para>
+ More information about Hibernate Annotations can be found in the <ulink
url="http://docs.jboss.org/hibernate/stable/annotations/reference/en...
Annotations Reference Guide</ulink>.
+ </para>
+ </section>
+ <section>
+ <title>Relevant Resources Links</title>
+ <para>
+ Find more information about native Dali plugin features on the <ulink
url="http://help.eclipse.org/galileo/index.jsp?nav=/8">Eclipse Documentation
page</ulink>.
+ </para>
+ </section>
+ </section>
</chapter>
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/reverseengineering.xml
===================================================================
---
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/reverseengineering.xml 2011-07-18
01:51:18 UTC (rev 32974)
+++
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/reverseengineering.xml 2011-07-18
01:59:12 UTC (rev 32975)
@@ -2,54 +2,44 @@
<chapter id="reverseengineering">
<title>Controlling reverse engineering</title>
- <para>When using the <code><jdbcconfiguration></code>,
the ant task will read the
- database metadata and thus will perform a reverse engineering of the database schema
into a
- normal Hibernate Configuration. It is from this object e.g.
<code><hbm2java></code>can generate other artifacts such as
<emphasis>
- <property>.java</property>
- </emphasis>, <emphasis>
- <property>.hbm.xml</property>
- </emphasis> etc.</para>
+ <para>
+ When using the <code><jdbcconfiguration></code> tag, the Ant
task will read the database metadata and then reverse engineer the database schema into a
normal Hibernate Configuration. It is from this object (e.g.
<code><hbm2java></code>) that other artifacts, such as
<filename>.java</filename> and <filename>.hbm.xml</filename>, can
be generated.
+ </para>
- <para>To govern this process <property>Hibernate</property> uses a
reverse engineering strategy. A
- reverse engineering strategy is mainly called to provide more java like names for
tables, column
- and foreignkeys into classes, properties and associations. It also used to provide
mappings from
- SQL types to <property>Hibernate</property> types. The strategy can be
customized by a user. The
- user can even provide its own custom reverse engineering strategy if the provided
strategy is
- not enough, or simply just provide a small part of the strategy and delegate the rest
to the
- default strategy.</para>
+ <para>
+ To govern this process <productname>Hibernate</productname> uses a reverse
engineering strategy. A reverse engineering strategy is mainly called to provide more Java
like names for tables, column and foreign keys into classes, properties and associations.
It is also used to provide mappings from SQL types to
<productname>Hibernate</productname> types.
+ </para>
+ <para>
+ The strategy can be customized by the user. This can be done by providing a custom
reverse engineering strategy should the default strategy does not include the required
functionality, or simply define a small component of the strategy and delegate the rest to
the default strategy.
+ </para>
- <para>Thus, further in this chapter we will discuss how you can configure the
process of a reverse
- engineering, what default reverse engineering strategy includes as well as some custom
concepts.</para>
+ <para>
+ Further in this chapter we will discuss how you can configure the process of reverse
engineering, what the default reverse engineering strategy includes, as well as some
custom concepts.
+ </para>
<section>
<title>Default reverse engineering strategy</title>
- <para>The default strategy uses some rules for mapping JDBC artifact names to
java artifact
- names. It also provide basic typemappings from JDBC types to
<property>Hibernate</property>
- types. It is the default strategy that uses the packagename attribute to convert a
table name
- to a fully qualified classname.</para>
+ <para>
+ The default strategy uses a collection of rules for mapping JDBC artifact names to
Java artifact names. It also provide basic type mappings from JDBC types to
<productname>Hibernate</productname> types. It is the default strategy that
uses the <code>packagename</code> attribute to convert a table name into a
fully qualified class name.
+ </para>
</section>
<section id="hibernaterevengxmlfile">
<title>hibernate.reveng.xml file</title>
- <para>To have fine control over the process a <emphasis>
- <property>hibernate.reveng.xml</property>
- </emphasis> file can be provided. In this file you can specify type mappings
and table
- filtering. This file can be created by hand (it's just basic XML) or you
can use the
- <ulink
url="http://www.hibernate.org/30.html">Hibernate
plugins</ulink> which have a
- specialized editor.</para>
+ <para>
+ A <filename>hibernate.reveng.xml</filename> file can provide a finer
degree of control of the reverse engineering process. In this file you can specify type
mappings and table filtering. This file can be created by hand (it's just basic
XML) or you can use the <ulink
url="http://www.hibernate.org/30.html">Hibernate plugins</ulink>, which
provides a specialized editor.
+ </para>
<note>
<title>Note:</title>
- <para>Many databases are case-sensitive with their names and thus if you
cannot make some
- table match and you are sure it is not excluded by a
<code><table-filter></code> then check
- if the case matches; most databases stores table names in
uppercase.</para>
+ <para>
+ Many databases have case-sensitive names, so if a table does not match, and you
are sure it is not excluded by a <code><table-filter></code>,
check that the case matches. Most databases stores table names in upper case.
+ </para>
</note>
- <para>Below you can see an example of a <emphasis>
- <property>reveng.xml</property>. </emphasis> Following the
example gives you more details
- about the format.</para>
+ <para>Below you can see an example of a
<filename>reveng.xml</filename> file.</para>
<programlisting role="XML"><![CDATA[<?xml
version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering
@@ -106,44 +96,33 @@
<section>
<title>Schema Selection (<schema-selection>)</title>
- <para><code><schema-selection></code> is used to
drive which schemas the reverse engineering will try and
- process.</para>
+ <para>The <code><schema-selection></code> tag is
used to determine which schemas the reverse engineering will try and
process.</para>
- <para>By default the reverse engineering will read all schemas and then use
<code><table-filter></code>
- to decide which tables get reverse engineered and which do not; this makes it
- easy to get started but can be inefficient on databases with many
schemas.</para>
+ <para>
+ By default the reverse engineering will read all schemas and then use the
<code><table-filter></code> tag to decide which tables are
reverse engineered and which are not. This makes it easy to get started but can be
inefficient on databases with many schemas.
+ </para>
- <para>With <code><schema-selection></code> it is
thus possible to limit the actual processed schemas and thus significantly
- speed-up the reverse engineering.
<code><table-filter></code> is still used to then decide which
tables will be included/excluded.</para>
+ <para>
+ With the <code><schema-selection></code> tag it is thus
possible to limit which schemas are processed, which in turn can significantly speed-up
the reverse engineering. The <code><table-filter></code> tag is
still used to then decide which tables will be included and excluded.
+ </para>
<note>
<title>Note:</title>
- <para>If no <code><schema-selection></code> is
specified, the reverse
- engineering works as if all schemas should be processed. This is equal to:
- <![CDATA[<schema-selection/>]]>. Which in turn is equal to:
- <![CDATA[<schema-selection match-catalog=".*"
match-schema=".*" match-table=".*"/>]]></para>
+ <para>
+ If no <code><schema-selection></code> tag is
specified, the reverse engineering works as if all schemas should be processed. This is
equal to: <![CDATA[<schema-selection/>]]>, which in turn is equal to:
<![CDATA[<schema-selection match-catalog=".*" match-schema=".*"
match-table=".*"/>]]>
+ </para>
</note>
<section>
<title>Examples</title>
- <para>The following will process all tables from <emphasis>
- <property>"MY_SCHEMA"</property>.
- </emphasis></para>
+ <para>The following will process all tables from
<code>"MY_SCHEMA"</code>.</para>
<programlisting role="XML"><![CDATA[<schema-selection
match-schema="MY_SCHEMA"/>]]></programlisting>
- <para>It is possible to have multiple
<literal>schema-selection</literal>'s to support
- multi-schema reading or simply to limit the processing to very specific tables.
The
- following example processes all tables in <emphasis>
- <property>"MY_SCHEMA"</property>,
- </emphasis> a specific <emphasis>
- <property>"CITY"</property>
- </emphasis> table plus all tables that starts with <emphasis>
- <property>"CODES_"</property>
- </emphasis> in <emphasis>
- <property>"COMMON_SCHEMA"</property>.
- </emphasis></para>
+ <para>
+ It is possible to have multiple <code>schema-selection</code>'s
to support multi-schema reading, or to limit the processing to very specific tables. The
following example processes all tables in
<code>"MY_SCHEMA"</code>, a specific
<code>"CITY"</code> table plus all tables that start with
<code>"CODES_"</code> in
<code>"COMMON_SCHEMA"</code>.
+ </para>
<programlisting role="XML"><![CDATA[<schema-selection
match-schema="MY_SCHEMA"/>
<schema-selection match-schema="COMMON_SCHEMA"
match-table="CITY"/>
@@ -154,13 +133,9 @@
<section id="type_map">
<title>Type mappings (<type-mapping>)</title>
- <para>The <code><type-mapping></code> section
specifies how the JDBC types found in the database should be mapped to
- Hibernate types. e.g. <emphasis>
- <property>java.sql.Types.VARCHAR</property></emphasis> with a
length of 1 should be mapped to the
- Hibernate type <emphasis>
- <property>yes_no</property></emphasis> or <emphasis>
- <property>java.sql.Types.NUMERIC</property></emphasis>
should generally just be
- converted to the Hibernate type
<literal>long</literal>.</para>
+ <para>
+ The <code><type-mapping></code> section specifies how
the JDBC types found in the database should be mapped to Hibernate types. e.g.
<code>java.sql.Types.VARCHAR</code> with a length of 1 should be mapped to the
Hibernate type <code>yes_no</code>, or
<code>java.sql.Types.NUMERIC</code> should generally just be converted to the
Hibernate type <code>long</code>.
+ </para>
<programlisting role="XML"><![CDATA[<type-mapping>
<sql-type
@@ -173,16 +148,14 @@
/>
</type-mapping>]]></programlisting>
- <para>The number of attributes specified and the sequence of the
<literal>sql-type</literal>'s
- is important. Meaning that <property>Hibernate</property> will search
for the most specific
- first, and if no specific match is found it will seek from top to bottom when
trying to
- resolve a type mapping.</para>
+ <para>
+ The number of attributes specified and the sequence of the
<code>sql-type</code> tags are important. This is because
<productname>Hibernate</productname> will search for the most specific first,
and if no specific match is found it will seek from top to bottom when trying to resolve a
type mapping.
+ </para>
<section>
<title>Example</title>
- <para>The following is an example of a type-mapping which shows the
flexibility and the
- importance of ordering of the type mappings.</para>
+ <para>The following is an example of a type-mapping which shows the
flexibility and importance of the ordering of the type mappings.</para>
<programlisting role="XML"><![CDATA[<type-mapping>
<sql-type jdbc-type="NUMERIC" precision="15"
hibernate-type="big_decimal"/>
@@ -195,8 +168,7 @@
<sql-type jdbc-type="VARCHAR" hibernate-type="string"/>
</type-mapping>]]></programlisting>
- <para>The following table shows how this affects an example table named
<emphasis>
- <property>CUSTOMER</property>:</emphasis></para>
+ <para>The following table shows how this affects an example table named
<code>CUSTOMER</code>:</para>
<table frame="topbot">
<title>sql-type examples</title>
@@ -264,9 +236,9 @@
<entry>your.package.TrimStringUserType</entry>
- <entry>No type-mapping matches length=30 and not-null=false, but
type-mapping
- matches the 2 mappings which only specifies VARCHAR. The type-mapping
that comes
- first is chosen.</entry>
+ <entry>
+ No type-mapping matches <code>length=30</code> and
<code>not-null=false</code>, but type-mapping matches the 2 mappings which
only specifies <code>VARCHAR</code>. The type-mapping that comes first is
chosen.
+ </entry>
</row>
<row>
@@ -282,10 +254,8 @@
<entry>char</entry>
- <entry>Even though there is a generic match for VARCHAR, the more
specific
- type-mapping for VARCHAR with not-null="false" is chosen. The
first VARCHAR
- sql-type matches in length but has no value for not-null and thus is
not
- considered.</entry>
+ <entry>
+ Even though there is a generic match for
<code>VARCHAR</code>, the more specific type-mapping for
<code>VARCHAR</code> with <code>not-null="false"</code>
is chosen. The first <code>VARCHAR</code> sql-type matches in length but has
no value for not-null and thus is not considered.</entry>
</row>
<row>
@@ -301,7 +271,7 @@
<entry>java.lang.Character</entry>
- <entry>The most specific VARCHAR with not-null="true" is
selected</entry>
+ <entry>The most specific <code>VARCHAR</code> with
<code>not-null="true"</code> is selected</entry>
</row>
<row>
@@ -317,7 +287,7 @@
<entry>big_decimal</entry>
- <entry>There is a precise match for NUMERIC with precision
15</entry>
+ <entry>There is a precise match for
<code>NUMERIC</code> with precision 15</entry>
</row>
<row>
@@ -333,7 +303,7 @@
<entry>java.lang.Long</entry>
- <entry>type-mapping for NUMERIC with
not-null="false"</entry>
+ <entry>type-mapping for <code>NUMERIC</code> with
<code>not-null="false"</code></entry>
</row>
</tbody>
</tgroup>
@@ -346,10 +316,9 @@
<section>
<title>Table filters (<table-filter>)</title>
- <para>The <code><table-filter></code>
- let you specify matching rules for performing general filtering/setup for
- tables, e.g. let you include or exclude specific tables based on the schema or
even a
- specific prefix.</para>
+ <para>
+ The <code><table-filter></code> tag lets you specify
matching rules for performing general filtering and setup of tables, e.g. let you include
or exclude specific tables based on the schema or even a specific prefix.
+ </para>
<programlisting role="XML"><![CDATA[<table-filter
match-catalog="catalog_matching_rule"
@@ -433,10 +402,9 @@
<section id="tab_and_col">
<title>Specific table configuration (<table>)</title>
- <para><code><table></code>
- allows you to provide explicit configuration on how a table should be reverse
- engineered. Amongst other things it allows controlling over the naming of a class
for the
- table, specifying which identifier generator should be used for the primary key
etc.</para>
+ <para>
+ The <code><table></code> tag allows you to explicitly
define how a table should be reverse engineered. It allows control over the naming of a
class for the table, provides a way to specify which identifier generator should be used
for the primary key and more.
+ </para>
<programlisting role="XML"><![CDATA[<table
catalog="catalog_name"
@@ -475,9 +443,10 @@
<row>
<entry><para>catalog</para></entry>
- <entry><para>Catalog name for a table. It has to be specified
if you are
- reverse engineering multiple catalogs or if it is not equal to
- hiberante.default_catalog.</para></entry>
+ <entry>
+ <para>Catalog name for a table. It has to be specified if you are
reverse engineering multiple catalogs or if it is not equal to hiberante.default_catalog.
+ </para>
+ </entry>
<entry><para>Optional</para></entry>
</row>
@@ -485,9 +454,11 @@
<row>
<entry><para>schema</para></entry>
- <entry><para>Schema name for a table. It has to be specified if
you are
- reverse engineering multiple schemas or if it is not equal to
- hiberante.default_schema.</para></entry>
+ <entry>
+ <para>
+ Schema name for a table. It has to be specified if you are reverse
engineering multiple schemas or if it is not equal to hiberante.default_schema.
+ </para>
+ </entry>
<entry><para>Optional</para></entry>
</row>
@@ -503,8 +474,7 @@
<row>
<entry><para>class</para></entry>
- <entry><para>The class name for a table. Default name is a
camelcase version
- of the table name.</para></entry>
+ <entry><para>The class name for a table. Default name is a
CamelCase version of the table name.</para></entry>
<entry><para>Optional</para></entry>
</row>
@@ -517,9 +487,9 @@
<section>
<title><primary-key></title>
- <para>A <code><primary-key></code> allows you to
define a primary-key for tables that don't have it
- defined in the database, and probably more importantly it allows you to define
which
- identifier strategy should be used (even for already existing
primary-key's).</para>
+ <para>
+ A <code><primary-key></code> tag allows you to define
a primary-key for tables that do not have one defined in the database, and more
importantly it allows you to define which identifier strategy should be used (even for
preexisting primary-key's).
+ </para>
<programlisting role="XML"><![CDATA[<primary-key
<generator class="generatorname">
@@ -554,9 +524,11 @@
<row>
<entry><para>generator/class</para></entry>
- <entry><para>Defines which identifier generator should be
used.
- The class name is any hibernate short hand name or fully qualified
class name for an
- identifier strategy.</para></entry>
+ <entry>
+ <para>
+ Defines which identifier generator should be used. The class name is
any hibernate short hand name or fully qualified class name for an identifier strategy.
+ </para>
+ </entry>
<entry><para>Optional</para></entry>
</row>
@@ -564,8 +536,7 @@
<row>
<entry><para>generator/param</para></entry>
- <entry><para>Allows to specify which parameter with a name
and
- value should be passed to the identifier
generator.</para></entry>
+ <entry><para>Allows to specify which parameter with a name
and value should be passed to the identifier generator.</para></entry>
<entry><para>Optional</para></entry>
</row>
@@ -573,8 +544,11 @@
<row>
<entry><para>key-column</para></entry>
- <entry><para>Specifies which column(s ) the primary-key
consists of. A
- key-column is same as column, but does not have the exclude
property.</para></entry>
+ <entry>
+ <para>
+ Specifies which column(s ) the primary-key consists of. A key-column is
same as column, but does not have the exclude property.
+ </para>
+ </entry>
<entry><para>Optional</para></entry>
</row>
@@ -589,11 +563,11 @@
<section>
<title><column></title>
- <para>With a <code><column></code> it is possible
to explicitly name the resulting property for a column. It is
- also possible to redefine what jdbc and/or Hibernate type a column should be
processed as
- and finally it is possible to completely exclude a column from
processing.</para>
+ <para>
+ With a <code><column></code> tag it is possible to
explicitly name the resulting property for a column, to redefine what JDBC and/or
Hibernate type a column should be processed as, and to completely exclude a column from
processing.
+ </para>
- <programlisting role="XML"><![CDATA[<column
+ <programlisting role="XML"><![CDATA[<column
name="column_name"
jdbc-type="java.sql.Types type"
type="hibernate_type"
@@ -635,9 +609,11 @@
<row>
<entry><para>jdbc-type</para></entry>
- <entry><para>Which jdbc-type this column should be processed
as. A
- value from java.sql.Types, either numerical (93) or the constant name
- (TIMESTAMP).</para></entry>
+ <entry>
+ <para>
+ Which jdbc-type this column should be processed as. A value from
<code>java.sql.Types</code>, either numerical (e.g. 93) or the constant name
(e.g. <code>TIMESTAMP</code>).
+ </para>
+ </entry>
<entry><para>Optional</para></entry>
</row>
@@ -654,8 +630,7 @@
<row>
<entry><para>property</para></entry>
- <entry><para>What property name will be generated for this
- column</para></entry>
+ <entry><para>What property name will be generated for this
column</para></entry>
<entry><para>Optional</para></entry>
</row>
@@ -678,12 +653,11 @@
<section>
<title><foreign-key></title>
- <para>The <code><foreign-key></code>
- has two purposes. One for allowing to define foreign-keys in databases that
- does not support them or does not have them defined in their schema. Secondly,
to allow
- defining the name of the resulting properties (many-to-one, one-to-one and
one-to-many's).</para>
+ <para>
+ The <code><foreign-key></code> tag has two purposes.
The first is to define foreign-keys in databases that does not support them or do not have
them defined in their schema. The second is to define the name of the resulting properties
(many-to-one, one-to-one and one-to-many's).
+ </para>
- <programlisting role="XML"><![CDATA[<foreign-key
+ <programlisting role="XML"><![CDATA[<foreign-key
constraint-name="foreignKeyName"
foreign-catalog="catalogName"
foreign-schema="schemaName"
@@ -730,9 +704,11 @@
<row>
<entry><para>constraint-name</para></entry>
- <entry><para>Name of the foreign key constraint. Important
when
- naming many-to-one, one-to-one and set. It is the constraint-name that
is used to link the
- processed foreign-keys with the resulting property
names.</para></entry>
+ <entry>
+ <para>
+ Name of the foreign key constraint. Important when naming many-to-one,
one-to-one and set. It is the constraint-name that is used to link the processed
foreign-keys with the resulting property names.
+ </para>
+ </entry>
<entry><para>Required</para></entry>
</row>
@@ -740,8 +716,7 @@
<row>
<entry><para>foreign-catalog</para></entry>
- <entry><para>Name of the foreign table's catalog. (Only
- relevant if you want to explicitly define a foreign
key).</para></entry>
+ <entry><para>Name of the foreign table's catalog. (Only
relevant if you want to explicitly define a foreign key).</para></entry>
<entry><para>Optional</para></entry>
</row>
@@ -749,8 +724,7 @@
<row>
<entry><para>foreign-schema</para></entry>
- <entry><para>Name of the foreign table's schema. (Only
relevant
- if you want to explicitly define a foreign
key).</para></entry>
+ <entry><para>Name of the foreign table's schema. (Only
relevant if you want to explicitly define a foreign key).</para></entry>
<entry><para>Optional</para></entry>
</row>
@@ -759,8 +733,7 @@
<row>
<entry><para>foreign-table</para></entry>
- <entry><para>Name of the foreign table. (Only relevant if
you
- want to explicitly define a foreign key).</para></entry>
+ <entry><para>Name of the foreign table. (Only relevant if you
want to explicitly define a foreign key).</para></entry>
<entry><para>Optional</para></entry>
</row>
@@ -768,9 +741,11 @@
<row>
<entry><para>column-ref </para></entry>
- <entry><para>Defines that the foreign-key constraint between
a
- local-column and foreign-column name. (Only relevant if you want to
explicitly
- define a foreign key).</para></entry>
+ <entry>
+ <para>
+ Defines the foreign-key constraint between a local-column and
foreign-column name. (Only relevant if you want to explicitly define a foreign key).
+ </para>
+ </entry>
<entry><para>Optional</para></entry>
</row>
@@ -778,9 +753,11 @@
<row>
<entry><para>many-to-one</para></entry>
- <entry><para>Defines that a many-to-one should be created and
the
- property attribute specifies the name of the resulting property.
Exclude can be
- used to explicitly define that it should be created or
not.</para></entry>
+ <entry>
+ <para>
+ Defines that a many-to-one should be created and the property attribute
specifies the name of the resulting property. Exclude can be used to explicitly define
that it should be created or not.
+ </para>
+ </entry>
<entry><para>Optional</para></entry>
</row>
@@ -788,9 +765,11 @@
<row>
<entry><para>set</para></entry>
- <entry><para>Defines that a set should be created based on
this foreign-key
- and the property attribute specifies the name of the resulting (set)
property.
- Exclude can be used to explicitly define that it should be created or
not.</para></entry>
+ <entry>
+ <para>
+ Defines that a set should be created based on this foreign-key and the
property attribute specifies the name of the resulting (set) property. Exclude can be used
to explicitly define that it should be created or not.
+ </para>
+ </entry>
<entry><para>Optional</para></entry>
</row>
@@ -798,9 +777,11 @@
<row>
<entry><para>one-to-one</para></entry>
- <entry><para>Defines that a one-to-one should be created and
the
- property attribute specifies the name of the resulting property.
Exclude can be
- used to explicitly define that it should be created or
not.</para></entry>
+ <entry>
+ <para>
+ Defines that a one-to-one should be created and the property attribute
specifies the name of the resulting property. Exclude can be used to explicitly define
that it should be created or not.
+ </para>
+ </entry>
<entry><para>Optional</para></entry>
</row>
@@ -808,9 +789,11 @@
<row>
<entry><para>inverse-one-to-one</para></entry>
- <entry><para>Defines that an inverse one-to-one should be
created based on this foreign-key
- and the property attribute specifies the name of the resulting
property.
- Exclude can be used to explicitly define that it should be created or
not.</para></entry>
+ <entry>
+ <para>
+ Defines that an inverse one-to-one should be created based on this
foreign-key and the property attribute specifies the name of the resulting property.
Exclude can be used to explicitly define that it should be created or not.
+ </para>
+ </entry>
<entry><para>Optional</para></entry>
</row>
@@ -826,17 +809,9 @@
<section id="custom-reveng-strategy">
<title>Custom strategy</title>
- <para>It is possible to implement a user strategy. Such strategy must implement
<emphasis>
-
<property>org.hibernate.cfg.reveng.ReverseEngineeringStrategy</property>.
- </emphasis> It is recommended that one uses the
- <property>DelegatingReverseEngineeringStrategy</property> and provide
a public constructor
- which takes another <property>ReverseEngineeringStrategy </property> as
an argument. This will
- allow you to only implement the relevant methods and provide a fallback strategy.
Example of
- custom delegating strategy which converts all column names that ends with
<emphasis>
- <property>"PK"</property>
- </emphasis> into a property named <emphasis>
- <property>"id"</property>.
- </emphasis></para>
+ <para>
+ It is possible to implement a user strategy. Such a strategy must implement
<code>org.hibernate.cfg.reveng.ReverseEngineeringStrategy</code>. It is
recommended that you use the <code>DelegatingReverseEngineeringStrategy</code>
and provide a public constructor which takes another
<code>ReverseEngineeringStrategy</code> as an argument. This will allow you to
only implement the relevant methods and provide a fall back strategy. An example is shown
below of a custom delegating strategy that converts all column names ending with
<code>"PK"</code> into a property named
<code>"id"</code>.
+ </para>
<programlisting role="JAVA"><![CDATA[public class ExampleStrategy
extends DelegatingReverseEngineeringStrategy {
@@ -857,21 +832,16 @@
<section>
<title>Custom Database Metadata</title>
- <para>By default the reverse engineering is performed by reading using the JDBC
database
- metadata API. This is done via the class <emphasis>
-
<property>org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect</property>
- </emphasis> which is an implementation of <emphasis>
-
<property>org.hibernate.cfg.reveng.dialect.MetaDataDialect</property>.
- </emphasis></para>
+ <para>
+ By default the reverse engineering is performed using the JDBC database metadata
API. This is done via the class
<code>org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect</code>, which is an
implementation of
<code>org.hibernate.cfg.reveng.dialect.MetaDataDialect</code>.
+ </para>
- <para>The default implementation can be replaced with an alternative
implementation by setting
- the property <emphasis>
- <property>hibernatetool.metadatadialect</property>
- </emphasis> to a fully qualified classname for a class that implements
- <property>JDBCMetaDataDialect</property>.</para>
+ <para>
+ The default implementation can be replaced with an alternative implementation by
setting the <code>hibernatetool.metadatadialect</code> property to a fully
qualified class name for a class that implements
<code>JDBCMetaDataDialect</code>.
+ </para>
- <para>This can be used to provide database specific optimized metadata reading.
If you create an
- optimized/better metadata reading for your database it will be a very welcome
- contribution.</para>
+ <para>
+ This can be used to provide database specific optimized metadata reading. If you
create an optimized metadata reader for your database it will be a very welcome
contribution.
+ </para>
</section>
</chapter>
Modified: branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/setup.xml
===================================================================
--- branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/setup.xml 2011-07-18
01:51:18 UTC (rev 32974)
+++ branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/setup.xml 2011-07-18
01:59:12 UTC (rev 32975)
@@ -1,115 +1,43 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<chapter id="setup">
- <title>Download and install Hibernate Tools</title>
- <para><property>Hibernate Tools</property> can be used
"standalone" via Ant 1.6.x or
- fully integrated into an Eclipse + WTP based IDE, such as <property>JBDS/JBoss
Tools</property>,
- or a default Eclipse + WTP installation. The following sections describe the install
steps in
- these environments.</para>
- <note>
- <title>Note:</title>
- <para>The <property>Hibernate Tools 3.3.0</property> (the current
release version) requires
- Eclipse Galileo 3.5.</para>
- </note>
- <section>
- <title>JBoss Tools</title>
- <para><property>JBoss Tools 3.1.0</property> (the latest release)
includes <property>Hibernate
- Tools 3.3.0</property> and thus nothing is required besides
<property>downloading</property>
- and <property>installing JBoss Tools</property>. If you need to update
to a newer version of
- the <property>Hibernate Tools</property> just follow the instructions
in the Eclipse IDE
- section.</para>
- </section>
- <section>
- <title>Eclipse IDE</title>
- <para>To install the <property>Hibernate Tools</property> into any
<property>Eclipse
- 3.5</property> based IDE you can either use <ulink
-
url="http://download.jboss.org/jbosstools/updates/stable/">J...
Tools Update Site</ulink>
- or install it manually.</para>
- <para>If you want to install the <property>Hibernate
Tools</property> distribution manually you
- need to:</para>
- <itemizedlist>
- <listitem>
- <para>Download from
www.eclipse.org:</para>
- <itemizedlist>
- <listitem>
- <para>birt-report-framework-2_5_0.zip</para>
- </listitem>
- <listitem>
- <para>birt-wtp-integration-sdk-2_3_2.zip</para>
- </listitem>
- <listitem>
- <para>dtp-sdk_1.7.0.zip</para>
- </listitem>
- <listitem>
- <para>eclipse-SDK-3.5-win32.zip</para>
- </listitem>
- <listitem>
- <para>emf-runtime-2.5.0.zip</para>
- </listitem>
- <listitem>
- <para>GEF-SDK-3.5.0.zip</para>
- </listitem>
- <listitem>
-
<para>org.eclipse.swtbot.eclipse.test-2.0.0.371-dev-e35.zip</para>
- </listitem>
- <listitem>
- <para>org.eclipse.swtbot.eclipse-2.0.0.340-dev.zip</para>
- </listitem>
- <listitem>
- <para>site-1.6.2.zip</para>
- </listitem>
- <listitem>
- <para>tptp.sdk-TPTP-4.6.0.zip</para>
- </listitem>
- <listitem>
- <para>wtp-sdk-R-3.1-20090616035105.zip</para>
- </listitem>
- <listitem>
- <para>xsd-runtime-2.5.0.zip</para>
- </listitem>
- </itemizedlist>
- </listitem>
- <listitem>
- <para>Then you should unpack these files into Eclipse install
folder.</para>
- </listitem>
- <listitem>
- <para>From <ulink
url="https://www.hibernate.org/6.html">hibernate.org-Download
Overview</ulink> download <ulink
url="http://downloads.sourceforge.net/project/jboss/JBossTools/JBoss...
Tools</ulink>
- .</para>
-
- </listitem>
- <listitem>
- <para>Unpack <property>Hibernate Tools</property> in
eclipse/dropins folder</para>
- </listitem>
- </itemizedlist>
- <note>
- <title>Note:</title>
- <para>If you need more detailed instructions on plugins installation and
general usage of eclipse
- then check out <ulink
url="https://eclipse-tutorial.dev.java.net/"
- >https://eclipse-tutorial.dev.java.net/</ulink> and especially
<ulink
-
url="https://eclipse-tutorial.dev.java.net/visual-tutorials/updatema...
-
>https://eclipse-tutorial.dev.java.net/visual-tutorials/updatemanager.html</ulink>
which
- covers using the update manager.</para>
- </note>
- <section>
- <title>Usage of Eclipse WTP</title>
- <para>The <property>Hibernate Tools</property> plugins currently
use <property>WTP
- 3.x</property> which at this time is the latest stable release from the
Eclipse Webtools
- project.</para>
- <para>Because the WTP project not always have had proper versioning of their
plugins there
- might exist WTP plugins in your existing eclipse directory from other Eclipse
based projects
- that are from an earlier WTP release but has either the same version number or
higher. It is
- thus recommended that if you have issues with WTP provided features to try and
install the
- plugins on a clean install of eclipse to ensure there are no version
collisions.</para>
- </section>
- </section>
- <section>
- <title>Ant</title>
- <para>To use the tools via Ant you need the <emphasis>
- <property>hibernate-tools.jar</property>
- </emphasis> and associated libraries. The libraries are included in the
distribution from the
- Hibernate website and the Eclipse updatesite. The libraries are located in the
eclipse plugins
- directory at <emphasis>
- <property>/plugins/org.hibernate.eclipse.x.x.x/lib/tools/</property>
- </emphasis>. These libraries are 100% independent from the eclipse platform.
How to use these
- via ant tasks are described in the <xref linkend="ant"/>
chapter.</para>
- </section>
+ <title>Download and install Hibernate Tools</title>
+ <para>
+ <productname>Hibernate Tools</productname> can be used
"standalone" via Ant 1.6.x or fully integrated into an Eclipse + WTP
based IDE, such as the case with <productname>JBDS/JBoss Tools</productname>,
or a default Eclipse + WTP installation. The following sections describe the install steps
in these environments.
+ </para>
+ <note>
+ <title>Note:</title>
+ <para>The <productname>Hibernate Tools 3.4.0</productname> (the
current release version) requires Eclipse Helios (3.6).</para>
+ </note>
+ <section>
+ <title>JBoss Tools</title>
+ <para>
+ <productname>JBoss Tools 3.4.0</productname> (the latest release) includes
<productname>Hibernate Tools 3.3.0</productname> and thus no additional steps
are required beyond downloading and installing <productname>JBoss
Tools</productname>. If you need to update to a newer version of the
<productname>Hibernate Tools</productname> just follow the instructions in
<xref linkend="eclipse_ide"/>.
+ </para>
+ </section>
+ <section id="eclipse_ide">
+ <title>Eclipse IDE</title>
+ <para>
+ To install the <productname>Hibernate Tools</productname> into any
<productname>Eclipse 3.6</productname> based IDE you can either use the
<ulink
url="http://download.jboss.org/jbosstools/updates/stable/">J...
Tools Update Site</ulink>.
+ </para>
+ <note>
+ <title>Note:</title>
+ <para>
+ If you need more detailed instructions on plugin installation and general usage of
<productname>Eclipse</productname> then check out <ulink
url="https://eclipse-tutorial.dev.java.net/">https://eclipse...
and especially <ulink
url="https://eclipse-tutorial.dev.java.net/visual-tutorials/updatema...
which covers the use of the update manager.
+ </para>
+ </note>
+ <section>
+ <title>Using Eclipse WTP</title>
+ <para>
+ The <productname>Hibernate Tools</productname> plugins currently use
<property>WTP 3.x</property>, which at this time is the latest stable release
from the <productname>Eclipse Webtools</productname> project.
+ </para>
+ <para>
+ Because the <productname>WTP</productname> project has not always used
proper versioning with their plugins, <productname>WTP</productname> plugins
may be present in your existing <productname>Eclipse</productname> directory
from other <productname>Eclipse</productname> based projects that are from an
earlier <productname>WTP</productname> release but has either the same version
number or higher. It is thus recommended that if you have issues with features provided by
<productname>WTP</productname> to install the plugins on a clean install of
<productname>Eclipse</productname> to ensure there are no version collisions.
+ </para>
+ </section>
+ </section>
+ <section>
+ <title>Ant</title>
+ <para>To use the tools via <productname>Ant</productname> you need
the <filename>hibernate-tools.jar</filename> file and associated libraries.
The libraries are included in the distribution from the
<productname>Hibernate</productname> website and the
<productname>Eclipse</productname> update site. The libraries are located in
the <productname>Eclipse</productname> plugins directory at
<filename>/plugins/org.hibernate.eclipse.x.x.x/lib/tools/</filename>. These
libraries are 100% independent from the <productname>Eclipse</productname>
platform. How to use the <productname>Hibernate Tools</productname> via
<productname>Ant</productname> tasks is described in <xref
linkend="ant"/>.
+ </para>
+ </section>
</chapter>
Modified: branches/jbosstools-3.2.x/hibernatetools/docs/reference/pom.xml
===================================================================
--- branches/jbosstools-3.2.x/hibernatetools/docs/reference/pom.xml 2011-07-18 01:51:18
UTC (rev 32974)
+++ branches/jbosstools-3.2.x/hibernatetools/docs/reference/pom.xml 2011-07-18 01:59:12
UTC (rev 32975)
@@ -1,7 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<project
xmlns="http://maven.apache.org/POM/4.0.0"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.tools</groupId>
@@ -10,229 +8,232 @@
<packaging>jdocbook</packaging>
<name>${bookname}-(${translation})</name>
- <properties>
- <translation>en-US</translation>
- <docname>Hibernatetools_Reference_Guide</docname>
- <bookname>Hibernatetools Reference Guide</bookname>
- </properties>
-
- <profiles>
+ <properties>
+ <translation>en-US</translation>
+ <docname>Hibernatetools_Reference_Guide</docname>
+ <bookname>Hibernatetools Reference Guide</bookname>
+ </properties>
+ <profiles>
+
<!-- mvn compile -->
- <profile>
- <id>all</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-jdocbook-plugin</artifactId>
- <version>2.3.3</version>
- <extensions>true</extensions>
- <configuration>
- <formats>
- <format>
- <formatName>pdf</formatName>
-
<stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
- <finalName>${docname}.pdf</finalName>
- </format>
- <format>
- <formatName>html</formatName>
-
<stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- <format>
- <formatName>html_single</formatName>
-
<stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- <format>
- <formatName>eclipse</formatName>
-
<stylesheetResource>classpath:/xslt/org/jboss/eclipse.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- </formats>
- </configuration>
- </plugin>
+ <profile>
+ <id>all</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.3.4</version>
+ <extensions>true</extensions>
+ <configuration>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
+ <finalName>${docname}.pdf</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>eclipse</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/eclipse.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <useRelativeImageUris>true</useRelativeImageUris>
+ </options>
+ </configuration>
+ </plugin>
</plugins>
</build>
</profile>
<!-- mvn compile -Phtml -->
- <profile>
- <id>html</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-jdocbook-plugin</artifactId>
- <version>2.3.3</version>
- <extensions>true</extensions>
- <configuration>
- <formats>
- <format>
- <formatName>html</formatName>
-
<stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- </formats>
- </configuration>
- </plugin>
+ <profile>
+ <id>html</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.3.3</version>
+ <extensions>true</extensions>
+ <configuration>
+ <formats>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ </configuration>
+ </plugin>
</plugins>
</build>
</profile>
<!-- mvn compile -Phtml-single -->
- <profile>
- <id>html-single</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-jdocbook-plugin</artifactId>
- <version>2.3.3</version>
- <extensions>true</extensions>
- </plugin>
+ <profile>
+ <id>html-single</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.3.3</version>
+ <extensions>true</extensions>
+ </plugin>
</plugins>
</build>
</profile>
<!-- mvn compile -Ppdf -->
- <profile>
- <id>pdf</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-jdocbook-plugin</artifactId>
- <version>2.3.3</version>
- <extensions>true</extensions>
- <configuration>
- <formats>
- <format>
- <formatName>pdf</formatName>
-
<stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
- <finalName>${docname}.pdf</finalName>
- </format>
- </formats>
- </configuration>
- </plugin>
+ <profile>
+ <id>pdf</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.3.3</version>
+ <extensions>true</extensions>
+ <configuration>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
+ <finalName>${docname}.pdf</finalName>
+ </format>
+ </formats>
+ </configuration>
+ </plugin>
</plugins>
</build>
</profile>
<!-- mvn compile -Peclipse -->
- <profile>
- <id>eclipse</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-jdocbook-plugin</artifactId>
- <version>2.3.3</version>
- <extensions>true</extensions>
- <configuration>
- <formats>
- <format>
- <formatName>eclipse</formatName>
-
<stylesheetResource>classpath:/xslt/org/jboss/eclipse.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- </formats>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
+ <profile>
+ <id>eclipse</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.3.3</version>
+ <extensions>true</extensions>
+ <configuration>
+ <formats>
+ <format>
+ <formatName>eclipse</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/eclipse.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
- </profiles>
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-jdocbook-plugin</artifactId>
- <version>2.3.3</version>
- <extensions>true</extensions>
- <dependencies>
- <dependency>
- <groupId>org.jboss.pressgang</groupId>
- <artifactId>pressgang-xslt</artifactId>
- <version>1.2.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossorg-jdocbook-style</artifactId>
- <version>1.1.1</version>
- <type>jdocbook-style</type>
- </dependency>
- </dependencies>
- <configuration>
- <sourceDirectory>${project.basedir}</sourceDirectory>
+ </profiles>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.3.3</version>
+ <extensions>true</extensions>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.pressgang</groupId>
+ <artifactId>pressgang-xslt</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-jdocbook-style</artifactId>
+ <version>1.1.1</version>
+ <type>jdocbook-style</type>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <sourceDirectory>${project.basedir}</sourceDirectory>
<!--
<sourceDocumentName>${docname}.xml</sourceDocumentName> -->
- <sourceDocumentName>master.xml</sourceDocumentName>
- <masterTranslation>en-US</masterTranslation>
- <imageResource>
- <directory>${project.basedir}/en-US</directory>
- <includes>
- <include>images/**/*</include>
- </includes>
- </imageResource>
- <formats>
- <format>
- <formatName>pdf</formatName>
-
<stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
- <finalName>${pdf.name}</finalName>
- </format>
- <format>
- <formatName>html</formatName>
-
<stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- <format>
- <formatName>html_single</formatName>
-
<stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- <format>
- <formatName>eclipse</formatName>
-
<stylesheetResource>classpath:/xslt/org/jboss/eclipse.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- </formats>
- <options>
- <xincludeSupported>true</xincludeSupported>
- <xmlTransformerType>saxon</xmlTransformerType>
- <docbookVersion>1.72.0</docbookVersion>
- <localeSeparator>-</localeSeparator>
- <transformerParameters>
- <property>
- <name>javax.xml.parsers.DocumentBuilderFactory</name>
- <value>org.apache.xerces.jaxp.DocumentBuilderFactoryImpl</value>
- </property>
- <property>
- <name>javax.xml.parsers.SAXParserFactory</name>
- <value>org.apache.xerces.jaxp.SAXParserFactoryImpl</value>
- </property>
- </transformerParameters>
- </options>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
+ <sourceDocumentName>master.xml</sourceDocumentName>
+ <masterTranslation>en-US</masterTranslation>
+ <imageResource>
+ <directory>${project.basedir}/en-US</directory>
+ <includes>
+ <include>images/**/*</include>
+ </includes>
+ </imageResource>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
+ <finalName>${pdf.name}</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>eclipse</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/eclipse.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xincludeSupported>true</xincludeSupported>
+ <xmlTransformerType>saxon</xmlTransformerType>
+ <docbookVersion>1.72.0</docbookVersion>
+ <localeSeparator>-</localeSeparator>
+ <transformerParameters>
+ <property>
+ <name>javax.xml.parsers.DocumentBuilderFactory</name>
+ <value>org.apache.xerces.jaxp.DocumentBuilderFactoryImpl</value>
+ </property>
+ <property>
+ <name>javax.xml.parsers.SAXParserFactory</name>
+ <value>org.apache.xerces.jaxp.SAXParserFactoryImpl</value>
+ </property>
+ </transformerParameters>
+ </options>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
</project>