From 2caffe4a3f90e86f808b8d46fec629535c215ee6 Mon Sep 17 00:00:00 2001 From: goik <goik@hdm-stuttgart.de> Date: Tue, 9 Apr 2013 11:39:22 +0200 Subject: [PATCH] centralized glossary, new chapter on identity/equality --- Doc/course.xml | 665 +++++++++++++++++++++++++++---------------------- 1 file changed, 368 insertions(+), 297 deletions(-) diff --git a/Doc/course.xml b/Doc/course.xml index da9f1f15f..1cbefa39e 100644 --- a/Doc/course.xml +++ b/Doc/course.xml @@ -30,6 +30,56 @@ </annotation> </info> + <glossary xml:id="glossary"> + <glossentry xml:id="gloss_Java"> + <glossterm><trademark + xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark></glossterm> + + <glossdef> + <para>General purpose programming language with support for object + oriented concepts.</para> + </glossdef> + </glossentry> + + <glossentry xml:id="gloss_Javadoc"> + <glossterm><trademark + xlink:href="http://docs.oracle.com/javase/1.5.0/docs/guide/javadoc">Javadoc</trademark></glossterm> + + <glossdef> + <para>Extracting documentation embedded in <link + linkend="gloss_Ja"><trademark>Java</trademark></link> source + code.</para> + </glossdef> + </glossentry> + + <glossentry xml:id="gloss_JPA"> + <glossterm><abbrev>JPA</abbrev></glossterm> + + <glossdef> + <para><link + xlink:href="http://www.javaworld.com/javaworld/jw-01-2008/jw-01-jpa1.html">Java + Persistence Architecture</link></para> + </glossdef> + </glossentry> + + <glossentry xml:id="gloss_ORM"> + <glossterm><abbrev>ORM</abbrev></glossterm> + + <glossdef> + <para>Object relational mapping.</para> + </glossdef> + </glossentry> + + <glossentry xml:id="gloss_XML"> + <glossterm><abbrev>XML</abbrev></glossterm> + + <glossdef> + <para>The <link xlink:href="http://www.w3.org/XML">Extensible Markup + Language</link>.</para> + </glossdef> + </glossentry> + </glossary> + <part xml:id="sda1"> <title>Structured Data and Applications 1</title> @@ -68,16 +118,17 @@ </glossentry> <glossentry> - <glossterm><trademark - xlink:href="http://docs.oracle.com/javase/1.5.0/docs/guide/javadoc">Javadoc</trademark> + <glossterm><link + linkend="gloss_Javadoc"><trademark>Javadoc</trademark></link> references and source code</glossterm> <glossdef> - <para>The lecture notes contain a lot of <trademark - xlink:href="http://docs.oracle.com/javase/1.5.0/docs/guide/javadoc">Javadoc</trademark> - references. For our own classes the <trademark - xlink:href="http://docs.oracle.com/javase/1.5.0/docs/guide/javadoc">Javadoc</trademark> - provides a link to the source code as well. For example when + <para>The lecture notes contain a lot of <link + linkend="gloss_Javadoc"><trademark>Javadoc</trademark></link> + references. Most classes appearing within these lecture notes + have <link + linkend="gloss_Javadoc"><trademark>Javadoc</trademark></link> + generated links to the source code as well. For example when clicking on the class name in <classname>sda.jdbc.intro.v1.SimpleInsert</classname> you will see the complete implementation.</para> @@ -254,15 +305,15 @@ importable projects.</para> <para>Depending on your eclipse installation you may have to - adjust the <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> + adjust the <link + linkend="gloss_Java"><trademark>Java</trademark></link> system libraries. Right click on your project root in the package explorer and choose <quote>Build Path --> Configure Buildpath</quote>. The <quote>JRE System Library</quote> entry in the <quote>Libraries</quote> tab may have to be changed to suit your eclipse's installation - needs. You may want to create a dummy <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> + needs. You may want to create a dummy <link + linkend="gloss_Java"><trademark>Java</trademark></link> project to find the correct setting.</para> </listitem> </itemizedlist> @@ -298,9 +349,9 @@ things!</para> <para>The Eclipse IDE will be used as the primary coding tool - especially for <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - and XML. Users may use different tools like e.g. <productname + especially for <link + linkend="gloss_Java"><trademark>Java</trademark></link> and XML. + Users may use different tools like e.g. <productname xlink:href="http://netbeans.org">Netbeans</productname> or <productname xlink:href="http://www.altova.com/de/xmlspy.html">XML-Spy</productname>. @@ -318,9 +369,9 @@ </listitem> </itemizedlist> - <para>Installation of eclipse requires a suitable <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - Development Kit.</para> + <para>Installation of eclipse requires a suitable <link + linkend="gloss_Java"><trademark>Java</trademark></link> Development + Kit.</para> <caution> <para>Your<productname @@ -360,17 +411,17 @@ apt-get install oracle-jdk7-installer</programlisting> <programlisting>goik@goiki:~$ <emphasis role="bold">java -version</emphasis> java version "1.7.0_07" -<trademark xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark>(TM) SE Runtime Environment (build 1.7.0_07-b10) -<trademark xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> HotSpot(TM) Server VM (build 23.3-b01, mixed mode)</programlisting> +Java(TM) SE Runtime Environment (build 1.7.0_07-b10) +Java HotSpot(TM) Server VM (build 23.3-b01, mixed mode)</programlisting> <para>The Eclipse IDE comes <link xlink:href="http://www.eclipse.org/downloads">with various flavours</link> depending on which plugins are already being shipped. For our purposes the <quote><productname>Eclipse - Classic</productname></quote> <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - edition is sufficient. You may however want to install other - flavours like <quote><productname>Eclipse IDE for Java EE + Classic</productname></quote> <link + linkend="gloss_Java"><trademark>Java</trademark></link> edition is + sufficient. You may however want to install other flavours like + <quote><productname>Eclipse IDE for Java EE Developers</productname></quote> if you require features beyond this course's needs. Remember to download the correct 32 or 64 bit version corresponding to your<productname @@ -523,9 +574,8 @@ mysql> FLUSH PRIVILEGES;</programlisting> # localhost which is more compatible and is not less secure. # <emphasis role="bold">bind-address = 127.0.0.1</emphasis></programlisting> - <para>Since we are dealing with <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - a <trademark + <para>Since we are dealing with <link + linkend="gloss_Java"><trademark>Java</trademark></link> a <trademark xlink:href="http://electronics.zibb.com/trademark/jdbc/29545026">JDBC</trademark> driver is needed to connect Applications to our <productname xlink:href="http://www.mysql.com">Mysql</productname> server:</para> @@ -566,9 +616,7 @@ remote: Counting objects: 694, done Resolving deltas: 100% (296/296), done.</programlisting> <para>After checkout an eclipse workspace holding the complete example - source code (<trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark>, - JQL,...) becomes visible:</para> + source code becomes visible:</para> <programlisting>goik@goiki:~/StructuredData$ cd ws/eclipse goik@goiki:~/StructuredData/ws/eclipse$ ls -al @@ -796,19 +844,19 @@ drwxr-xr-x 4 goik fb1prof 4096 Nov 8 22:04 .. foreign key constraints since relational tables themselves have a <quote>flat</quote> structure. Some RDBMS vendors provide extensions to the SQL standard which allow <quote>native</quote> representations - of <abbrev xlink:href="http://www.w3.org/XML">Xml</abbrev> + of <link linkend="gloss_XML"><abbrev>XML</abbrev></link> documents.</para> </section> <section xml:id="xmlHtml"> <title>Well formed XML documents</title> - <para>The general structure of an <abbrev - xlink:href="http://www.w3.org/XML">Xml</abbrev> document is as + <para>The general structure of an <link + linkend="gloss_XML"><abbrev>XML</abbrev></link> document is as follows:</para> <figure xml:id="xmlbase"> - <title><abbrev xlink:href="http://www.w3.org/XML">Xml</abbrev> basic + <title><link linkend="gloss_XML"><abbrev>XML</abbrev></link> basic structure</title> <mediaobject> @@ -1031,10 +1079,10 @@ terminated by the matching end-tag "</to>". parsing error</computeroutput> attribute name must be unique. In the example above one may not define a second attribute <varname>date="..."</varname> within the same element <memo ... >. This reflects the usual - programming language semantics of attributes: In a <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - class an attribute is represented by an unique identifier and thus - cannot appear twice.</para> + programming language semantics of attributes: In a <link + linkend="gloss_Java"><trademark>Java</trademark></link> class an + attribute is represented by an unique identifier and thus cannot + appear twice.</para> </listitem> <listitem> @@ -1648,19 +1696,17 @@ terminated by the matching end-tag "</to>". parsing error</computeroutput> DTD.</para> <para>This situation is quite similar as in typed programming - languages: A <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - <code>class</code> declaration is a blueprint for the - <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - runtime system to construct <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> + languages: A <link + linkend="gloss_Java"><trademark>Java</trademark></link> + <code>class</code> declaration is a blueprint for the <link + linkend="gloss_Java"><trademark>Java</trademark></link> + runtime system to construct <link + linkend="gloss_Java"><trademark>Java</trademark></link> objects in memory. This is done by e.g. a statement<code> String name = new String();</code>. The identifier <code>name</code> will hold a reference to an - <emphasis>instance of class String</emphasis>. So in a - <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> + <emphasis>instance of class String</emphasis>. So in a <link + linkend="gloss_Java"><trademark>Java</trademark></link> runtime environment a class declaration plays the same role as a DTD declaration in XML. See also <xref linkend="example_memoJavaClass"/>.</para> @@ -1776,20 +1822,20 @@ terminated by the matching end-tag "</to>". parsing error</computeroutput> <para>The aim of this exercise is to clarify the (abstract) relation between XML <abbrev xlink:href="http://en.wikipedia.org/wiki/Document_Type_Declaration">DTD</abbrev>'s - and sets of <trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark> + and sets of <link + linkend="gloss_Java"><trademark>Java</trademark></link> classes rather then building a running application. We want to model the <link xlink:href="Ref/src/Memo.1/memo.dtd">memo - DTD</link> as a set of <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> + DTD</link> as a set of <link + linkend="gloss_Java"><trademark>Java</trademark></link> classes.</para> </question> <answer> <para>The XML attributes <tag class="attribute">date</tag> and <tag class="attribute">priority</tag> can be mapped as - <trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark> + <link + linkend="gloss_Java"><trademark>Java</trademark></link> attributes. The same applies for the Memo elements <tag class="element">from</tag>, <tag class="element">subject</tag> and <tag @@ -1826,8 +1872,8 @@ public class Memo { <para>On the other hand our set of recipients has to be ordered: In a XML document instance the order of <tag class="starttag">to</tag> nodes is important and has to be - preserved in a <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> + preserved in a <link + linkend="gloss_Java"><trademark>Java</trademark></link> representation. Thus we choose an <classname>java.util.SortedSet</classname> parametrized with String type to fulfill both requirements.</para> @@ -1836,11 +1882,10 @@ public class Memo { <programlisting><!ATTLIST memo ... priority (low|medium|high) #IMPLIED></programlisting> - <para>Starting from <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - 1.5 we may implement this constraint by a type safe - enumeration in a file - <filename>Priority.java</filename>:</para> + <para>Starting from <link + linkend="gloss_Java"><trademark>Java</trademark></link> 1.5 + we may implement this constraint by a type safe enumeration + in a file <filename>Priority.java</filename>:</para> <programlisting language="java">public enum Priority{low, standard, high};</programlisting> </answer> @@ -2027,15 +2072,13 @@ public class Memo { <section xml:id="xmlAndJava"> <title>Relating <abbrev xlink:href="http://en.wikipedia.org/wiki/Document_Type_Declaration">DTD</abbrev>'s - and <trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark> + and <link linkend="gloss_Java"><trademark>Java</trademark></link> class descriptions.</title> - <para>We may also compare XML data constraints to <trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark>. - A <trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark> - class declaration is actually a blueprint for a <trademark + <para>We may also compare XML data constraints to <link + linkend="gloss_Java"><trademark>Java</trademark></link>. A <link + linkend="gloss_Java"><trademark>Java</trademark></link> class + declaration is actually a blueprint for a <trademark xlink:href="http://www.oracle.com/technetwork/java/javase">JRE</trademark> to instantiate compatible objects. Likewise an XML DTD restricts well-formed documents:</para> @@ -2043,8 +2086,7 @@ public class Memo { <figure xml:id="fig_XmlAndJava"> <title>XML <abbrev xlink:href="http://en.wikipedia.org/wiki/Document_Type_Declaration">DTD</abbrev>'s - and <trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark> + and <link linkend="gloss_Java"><trademark>Java</trademark></link> class declarations.</title> <mediaobject> @@ -2098,10 +2140,10 @@ public class Memo { identifier names for element names like <tag class="element">memo</tag>. We learn that such an identifier must not begin with a digit. So the rule presented here resembles the - grammar constraint on legal identifiers in the <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - programming language. The type <code>NMTOKEN</code> will be needed - later when defining element attributes.</para> + grammar constraint on legal identifiers in the <link + linkend="gloss_Java"><trademark>Java</trademark></link> programming + language. The type <code>NMTOKEN</code> will be needed later when + defining element attributes.</para> <productionset> <title>Names and Tokens</title> @@ -2252,9 +2294,9 @@ public class Memo { </constraintdef> <para>Programmers will not be surprised: The above constraint is - common to most programming languages. In <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - for example a given local variable may not be redefined:</para> + common to most programming languages. In <link + linkend="gloss_Java"><trademark>Java</trademark></link> for + example a given local variable may not be redefined:</para> <programlisting language="java">int count = 3; double pi=3.1415926; @@ -2639,7 +2681,7 @@ int count = 2; // Fatal error: A variable must not be operators <quote>,</quote> and <quote>|</quote> allow us to define sequences or mutually exclusive alternatives of element nodes. The XML standard defines the notion of <emphasis>content - particles</emphasis> (<abbrev>cp</abbrev>) which allows these + particles</emphasis> (<command>cp</command>) which allows these two types of structuring elements to be grouped and nested:</para> @@ -3280,9 +3322,9 @@ int count = 2; // Fatal error: A variable must not be <para>The first rule tells us that multiple attributes may be defined for a given element. This is quite <quote>normal</quote> since the same applies for example when attributes are defined - within <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - or C++ classes. Actually in <link + within <link + linkend="gloss_Java"><trademark>Java</trademark></link> or C++ + classes. Actually in <link xlink:href="http://www.w3.org/MarkUp">XHTML</link> the <tag class="emptytag">img</tag> element's attribute list is defined as:</para> @@ -4762,11 +4804,10 @@ double quote character.</errortext></programlisting> <para>We are already familiar with transformations of XML document instances to other formats. Sometimes the capabilities being offered by a given transformation approach do not suffice for a given - problem. Obviously a general purpose programming language like - <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - offers superior means to perform advanced manipulations of XML - document trees.</para> + problem. Obviously a general purpose programming language like <link + linkend="gloss_Java"><trademark>Java</trademark></link> offers + superior means to perform advanced manipulations of XML document + trees.</para> <para>Before diving into technical details we present an example exceeding the limits of our present transformation capabilities. We @@ -4787,7 +4828,7 @@ double quote character.</errortext></programlisting> <para>Our catalog might look like:</para> <figure xml:id="simpleCatalog"> - <title>A <abbrev xlink:href="http://www.w3.org/XML">Xml</abbrev> + <title>A <link linkend="gloss_XML"><abbrev>XML</abbrev></link> based catalog.</title> <programlisting><catalog> @@ -4862,14 +4903,14 @@ INSERT INTO Product VALUES('<emphasis role="bold">9921</emphasis>', 121.50)</pro However some XSLT processors provide extensions for this task.</para> - <para>It is tempting to write a <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - application which might use e.g. <trademark + <para>It is tempting to write a <link + linkend="gloss_Java"><trademark>Java</trademark></link> application + which might use e.g. <trademark xlink:href="http://electronics.zibb.com/trademark/jdbc/29545026">JDBC</trademark> for database access. But how do we actually read and parse a XML - file? Sticking to the <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - standard we might use a <link + file? Sticking to the <link + linkend="gloss_Java"><trademark>Java</trademark></link> standard we + might use a <link xlink:href="http://java.sun.com/j2se/1.5.0/docs/api/java/io/FileInputStream.html">FileInputStream</link> instance to read from <code>catalog.xml</code> and write a XML parser by ourself. Fortunately <orgname>SUN</orgname>'s <trademark @@ -5269,17 +5310,17 @@ Closing Document case empty content as above will not appear.</para> <para>The <code>characters(char[] ch, int start, int length)</code> - method's signature looks somewhat strange regarding <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - conventions. One might expect <code>characters(String s)</code>. But - this way the <acronym - xlink:href="http://www.saxproject.org">SAX</acronym> API allows - efficient parser implementations: A parser may initially allocate a - reasonable large <code>char</code> array of say 128 bytes sufficient - to hold 64 (<link xlink:href="http://unicode.org">Unicode</link>) - characters. If this buffer gets exhausted the parser might allocate - a second buffer of double size thus implementing an <quote>amortized - doubling</quote> algorithm:</para> + method's signature looks somewhat strange regarding <link + linkend="gloss_Java"><trademark>Java</trademark></link> conventions. + One might expect <code>characters(String s)</code>. But this way the + <acronym xlink:href="http://www.saxproject.org">SAX</acronym> API + allows efficient parser implementations: A parser may initially + allocate a reasonable large <code>char</code> array of say 128 bytes + sufficient to hold 64 (<link + xlink:href="http://unicode.org">Unicode</link>) characters. If this + buffer gets exhausted the parser might allocate a second buffer of + double size thus implementing an <quote>amortized doubling</quote> + algorithm:</para> <mediaobject> <imageobject> @@ -5845,8 +5886,8 @@ localName='HTML'</programlisting> <para>XML documents allow for automated content processing. We already discussed the <acronym xlink:href="http://www.saxproject.org">SAX</acronym> API to access - XML documents by <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> + XML documents by <link + linkend="gloss_Java"><trademark>Java</trademark></link> applications. There are however situations where <acronym xlink:href="http://www.saxproject.org">SAX</acronym> is not appropriate:</para> @@ -5908,10 +5949,10 @@ localName='HTML'</programlisting> <para>In order to use the <acronym xlink:href="http://www.w3.org/DOM">DOM</acronym> API by a concrete programming language a so called <emphasis>language - binding</emphasis> is required. In languages like <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - the language binding will still be a set of (<trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark>) + binding</emphasis> is required. In languages like <link + linkend="gloss_Java"><trademark>Java</trademark></link> the + language binding will still be a set of (<link + linkend="gloss_Java"><trademark>Java</trademark></link>) interfaces. Thus for actually coding an application an implementation of these interfaces is needed</para> </listitem> @@ -5919,11 +5960,11 @@ localName='HTML'</programlisting> <para>So what exactly may an <abbrev xlink:href="http://en.wikipedia.org/wiki/Interface_description_language">IDL</abbrev> - be? The programming language <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - already allows pure interface definitions without any - implementation. In C++ the same result can be achieved by so called - <emphasis>pure virtual classes</emphasis>. An <abbrev + be? The programming language <link + linkend="gloss_Java"><trademark>Java</trademark></link> already + allows pure interface definitions without any implementation. In C++ + the same result can be achieved by so called <emphasis>pure virtual + classes</emphasis>. An <abbrev xlink:href="http://en.wikipedia.org/wiki/Interface_description_language">IDL</abbrev> offers extended features to describe such interfaces. For <acronym xlink:href="http://www.w3.org/DOM">DOM</acronym> the <productname @@ -5960,19 +6001,17 @@ localName='HTML'</programlisting> <para>If we want to implement the <abbrev xlink:href="http://en.wikipedia.org/wiki/Interface_description_language">IDL</abbrev> - <classname>org.w3c.dom.Node</classname> specification in e.g. - <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - a language binding has to be defined. This means writing <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - code which closely resembles the <abbrev + <classname>org.w3c.dom.Node</classname> specification in e.g. <link + linkend="gloss_Java"><trademark>Java</trademark></link> a language + binding has to be defined. This means writing <link + linkend="gloss_Java"><trademark>Java</trademark></link> code which + closely resembles the <abbrev xlink:href="http://en.wikipedia.org/wiki/Interface_description_language">IDL</abbrev> specification. Obviously this task depends on and is restricted by the constructs being offered by the target programming language. The W3C <link xlink:href="http://www.w3.org/TR/DOM-Level-3-Core/java-binding.html">defines</link> - the <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> + the <link linkend="gloss_Java"><trademark>Java</trademark></link> <classname>org.w3c.dom.Node</classname> interface by:</para> <programlisting language="java">package org.w3c.dom; @@ -5996,7 +6035,8 @@ public interface Node { ... }</programlisting> - <para>We take <methodname>org.w3c.dom.Node.getChildNodes()</methodname> as an + <para>We take + <methodname>org.w3c.dom.Node.getChildNodes()</methodname> as an example:</para> <figure xml:id="domRetrieveChildren"> @@ -6030,15 +6070,15 @@ public interface Node { <para>An XML API may address this issue by offering data types to represent these different kinds of nodes. The <acronym - xlink:href="http://www.w3.org/DOM">DOM</acronym> <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - Binding defines an inheritance hierarchy of interfaces for this + xlink:href="http://www.w3.org/DOM">DOM</acronym> <link + linkend="gloss_Java"><trademark>Java</trademark></link> Binding + defines an inheritance hierarchy of interfaces for this purpose:</para> <figure xml:id="domJavaNodeInterfaces"> <title>Inheritance interface hierarchy in the <acronym - xlink:href="http://www.w3.org/DOM">DOM</acronym> <trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark> + xlink:href="http://www.w3.org/DOM">DOM</acronym> <link + linkend="gloss_Java"><trademark>Java</trademark></link> binding</title> <mediaobject> @@ -6048,8 +6088,8 @@ public interface Node { </mediaobject> </figure> - <para>Two commonly used <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> + <para>Two commonly used <link + linkend="gloss_Java"><trademark>Java</trademark></link> implementations of these interfaces are:</para> <variablelist> @@ -6688,11 +6728,11 @@ public class Article2Html { xlink:href="http://www.w3.org/TR/xpath">XPath</acronym> can be compared to SQL queries when working with relational databases. <acronym xlink:href="http://www.w3.org/TR/xpath">XPath</acronym> may - also be used within <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - code. As a first example we show an image filename extracting - application operating on XHTML documents. The following example - contains three <tag class="starttag">img</tag> elements:</para> + also be used within <link + linkend="gloss_Java"><trademark>Java</trademark></link> code. As a + first example we show an image filename extracting application + operating on XHTML documents. The following example contains three + <tag class="starttag">img</tag> elements:</para> <figure xml:id="htmlGallery"> <title>A HTML document containing <code>IMG</code> tags.</title> @@ -6761,11 +6801,11 @@ public class Article2Html { a list of image filenames being contained in the HTML page i.e. <code>inline.gif one.gif two.gif</code>.</para> - <para>Now we want to write a <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - application which allows to check whether these referenced image - files do exist and have sufficient permissions to be accessed. A - simple approach may pipe the <abbrev + <para>Now we want to write a <link + linkend="gloss_Java"><trademark>Java</trademark></link> application + which allows to check whether these referenced image files do exist + and have sufficient permissions to be accessed. A simple approach + may pipe the <abbrev xlink:href="http://www.w3.org/Style/XSL">XSL</abbrev> output to our application which then executes the readability checks. Instead we want to incorporate the <acronym @@ -6883,8 +6923,8 @@ public class DomXpath { xlink:href="http://www.w3.org/TR/xpath">XPath</acronym> <code>//img</code> expression is guaranteed to return only <tag class="starttag">img</tag> elements. Thus within our - <trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark> + <link + linkend="gloss_Java"><trademark>Java</trademark></link> context we are sure to find only <classname>org.jdom2.Element</classname> instances.</para> </answer> @@ -7032,9 +7072,8 @@ public class CheckExtImage { <abbrev xlink:href="http://www.w3.org/Style/XSL">XSL</abbrev></title> - <para><trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark> - based <abbrev xlink:href="http://www.w3.org/XML">Xml</abbrev> + <para><link linkend="gloss_Java"><trademark>Java</trademark></link> + based <link linkend="gloss_XML"><abbrev>XML</abbrev></link> applications may use XSL style sheets for processing. A <acronym xlink:href="http://www.w3.org/DOM">DOM</acronym> tree may for example be transformed into another tree. The package <link @@ -7043,8 +7082,8 @@ public class CheckExtImage { following product catalog example:</para> <figure xml:id="climbingCatalog"> - <title>A simplified <abbrev - xlink:href="http://www.w3.org/XML">Xml</abbrev> product + <title>A simplified <link + linkend="gloss_XML"><abbrev>XML</abbrev></link> product catalog</title> <programlisting><?xml version="1.0" encoding="UTF-8"?> @@ -7126,10 +7165,9 @@ public class CheckExtImage { <para>As a preparation for <xref linkend="exercise_catalogRdbms"/> we now demonstrate the usage of <abbrev - xlink:href="http://www.w3.org/Style/XSL">XSL</abbrev> within a - <trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark> - application. This is done by a <link + xlink:href="http://www.w3.org/Style/XSL">XSL</abbrev> within a <link + linkend="gloss_Java"><trademark>Java</trademark></link> application. + This is done by a <link xlink:href="http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/transform/Transformer.html">Transformer</link> instance:</para> @@ -7251,11 +7289,11 @@ INSERT INTO Product VALUES('w-124', 110.40);</programlisting> <answer> <para>The additional functionality on top of <xref linkend="xml2xml"/> is represented by a method - <methodname>dom.xsl.XmlRdbms2Html.addPrices()</methodname>. This method modifies the - <acronym xlink:href="http://www.w3.org/DOM">DOM</acronym> - input tree prior to applying the XSL. Prices are being - inserting based on data received from an RDBMS via - <trademark + <methodname>dom.xsl.XmlRdbms2Html.addPrices()</methodname>. + This method modifies the <acronym + xlink:href="http://www.w3.org/DOM">DOM</acronym> input tree + prior to applying the XSL. Prices are being inserting based + on data received from an RDBMS via <trademark xlink:href="http://electronics.zibb.com/trademark/jdbc/29545026">JDBC</trademark>:</para> <programlisting language="java">package dom.xsl; @@ -8144,11 +8182,10 @@ for (int i = 0; i < 10; i++){ max[i] = maximum(a[i], b[i]); }</programlisting> - <para>So far calling a static method in <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - may be compared to a <tag - class="starttag">xsl:apply-templates</tag>. There is however one big - difference. In <abbrev + <para>So far calling a static method in <link + linkend="gloss_Java"><trademark>Java</trademark></link> may be + compared to a <tag class="starttag">xsl:apply-templates</tag>. There + is however one big difference. In <abbrev xlink:href="http://www.w3.org/Style/XSL">XSL</abbrev> the <quote>method</quote> being called may not exist at all. A <tag class="starttag">xsl:apply-templates</tag> instructs a processor to @@ -9597,9 +9634,9 @@ Jack Eve Jude <----Tolstoi----> <co </blockquote> <para>The notion of <quote>process</quote> refers to operating - systems. Let us start wit a simple example assuming a <trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark> - class User:</para> + systems. Let us start wit a simple example assuming a <link + linkend="gloss_Java"><trademark>Java</trademark></link> class + User:</para> <programlisting>public class User { String cname; //The user's common name e.g. 'Joe Bix' @@ -9616,10 +9653,10 @@ Jack Eve Jude <----Tolstoi----> <co ,CHAR(10) uid PRIMARY KEY )</programlisting> - <para>Now a <trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark> - application may create instances of class <code>User</code> and save - these to a database:</para> + <para>Now a <link + linkend="gloss_Java"><trademark>Java</trademark></link> application + may create instances of class <code>User</code> and save these to a + database:</para> <figure xml:id="processObjPersist"> <title>Persistence across process boundaries</title> @@ -9852,8 +9889,8 @@ Jack Eve Jude <----Tolstoi----> <co <para>Vendor neutral specific parts of a <trademark xlink:href="http://www.oracle.com/technetwork/java/javase/jdbc">JDBC</trademark> environment. These are those components being shipped by Oracle - or other organizations providing <trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark> + or other organizations providing <link + linkend="gloss_Java"><trademark>Java</trademark></link> runtimes. The class <classname>java.sql.DriverManager</classname> belongs to this domain.</para> @@ -10014,16 +10051,14 @@ Jack Eve Jude <----Tolstoi----> <co as a prerequisite to open connections to a database server. This implementation is mandatory for our toy application as well. All we have to do is adding <filename>mysql-connector-java.jar</filename> - to our <trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark> + to our <link linkend="gloss_Java"><trademark>Java</trademark></link> <varname>CLASSPATH</varname> at <emphasis role="bold">runtime</emphasis>.</para> - <para>Depending on our <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - environment this will be achieved by different means. Eclipse - requires the definition of a run configuration as being described in - <uri + <para>Depending on our <link + linkend="gloss_Java"><trademark>Java</trademark></link> environment + this will be achieved by different means. Eclipse requires the + definition of a run configuration as being described in <uri xlink:href="http://help.eclipse.org/juno/index.jsp?topic=/org.eclipse.jdt.doc.user/tasks/tasks-java-local-configuration.htm">http://help.eclipse.org/juno/index.jsp?topic=/org.eclipse.jdt.doc.user/tasks/tasks-java-local-configuration.htm</uri>. When configuring a run-time configuration for <classname>sda.jdbc.intro.SimpleInsert</classname> we have to add @@ -10090,12 +10125,11 @@ Jack Eve Jude <----Tolstoi----> <co need concrete classes.</para> <para>On the other hand when working with eclipse we need a separate - runtime configuration for each runnable <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - application. This becomes tedious after some time. So you may want - to follow the author and just add - <filename>mysql-connector-java.jar</filename> to your compile time - <envar>CLASSPATH</envar>.</para> + runtime configuration for each runnable <link + linkend="gloss_Java"><trademark>Java</trademark></link> application. + This becomes tedious after some time. So you may want to follow the + author and just add <filename>mysql-connector-java.jar</filename> to + your compile time <envar>CLASSPATH</envar>.</para> <para>We now discuss some important methods being defined in the relevant <trademark @@ -10345,8 +10379,8 @@ Statement createStatement(int resultSetType, interfaces rather than a vendor's classes it is much easier to make the resulting application work with different databases from other vendors. This way a company's - implementation is not exposed to our own <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> + implementation is not exposed to our own <link + linkend="gloss_Java"><trademark>Java</trademark></link> code.</para> <para>Regarding the special role of @@ -10501,9 +10535,9 @@ public someClass { <para>Professional applications must be configurable. Changing the password currently requires source code modification and - recompilation. <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - offers a standard procedure to externalize parameters like + recompilation. <link + linkend="gloss_Java"><trademark>Java</trademark></link> offers a + standard procedure to externalize parameters like <varname>username</varname>, <varname>password</varname> an <trademark xlink:href="http://electronics.zibb.com/trademark/jdbc/29545026">JDBC</trademark> @@ -10562,9 +10596,9 @@ SimpleInsert.username=hdmuser</programlisting> <answer> <para>The current exercise is mostly related to tooling. - From our <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - code the context menu allows us to choose the desired + From our <link + linkend="gloss_Java"><trademark>Java</trademark></link> code + the context menu allows us to choose the desired wizard:</para> <informalfigure> @@ -10970,8 +11004,8 @@ PersistenceHandler.username=foo</pre> <para>According to the above documentation a newly created <code>PersistenceHandler</code> instance should be in - disconnected state. As being shown in the <trademark - xlink:href="http://docs.oracle.com/javase/1.5.0/docs/guide/javadoc">Javadoc</trademark> + disconnected state. As being shown in the <link + linkend="gloss_Java"><trademark>Java</trademark></link> class description you may test your implementation without any GUI code. If you are already familiar with unit testing this might be a good start as well.</para> @@ -11177,8 +11211,10 @@ PersistenceHandler.username=foo</pre> <para>Notice also the <classname>java.awt.event.WindowAdapter</classname> implementation being executed when closing the application's - main window. The <methodname>java.awt.event.WindowAdapter.windowClosing(java.awt.event.WindowEvent)</methodname> method disconnects any existing database - connection thus freeing resources.</para> + main window. The + <methodname>java.awt.event.WindowAdapter.windowClosing(java.awt.event.WindowEvent)</methodname> + method disconnects any existing database connection thus + freeing resources.</para> <programlisting language="java">package sda.jdbc.intro.v1; @@ -11695,16 +11731,16 @@ public class InsertPerson extends JFrame { </figure> <qandaset role="exercise"> - <title>Using regular expressions in <trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark></title> + <title>Using regular expressions in <link + linkend="gloss_Java"><trademark>Java</trademark></link></title> <qandadiv> <qandaentry> <question> <para>This exercise is a preparation for <xref linkend="exercisefilterUserInput"/>. The aim is to deal - with regular expressions and to use them in <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark>. + with regular expressions and to use them in <link + linkend="gloss_Java"><trademark>Java</trademark></link>. If you don't know yet about regular expressions / pattern matching you may want to read either of:</para> @@ -11761,8 +11797,8 @@ public static boolean testMatch(final String word, final String regexp) { .../* to be implemented by <emphasis role="bold">**YOU**</emphasis> */ }</programlisting> - <para>As being noted in the <trademark - xlink:href="http://docs.oracle.com/javase/1.5.0/docs/guide/javadoc">Javadoc</trademark> + <para>As being noted in the <link + linkend="gloss_Java"><trademark>Java</trademark></link> above you may want to read the documentation of class <classname>java.util.regex.Pattern</classname>. The intended output of the above application is:</para> @@ -11839,8 +11875,8 @@ The expression '[^0-9]+.*' ... </listitem> <listitem> - <para>The <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> + <para>The <link + linkend="gloss_Java"><trademark>Java</trademark></link> standard class <classname>javax.swing.InputVerifier</classname> may help you validating user input.</para> @@ -11985,8 +12021,8 @@ public class InsertPerson extends JFrame { to a database server:</para> <figure xml:id="sqlTransport"> - <title>SQL statements in <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> + <title>SQL statements in <link + linkend="gloss_Java"><trademark>Java</trademark></link> applications get parsed at the database server</title> <mediaobject> @@ -12280,9 +12316,9 @@ public class SimpleInsert { <para>So far we've only covered the second (<code>UPDATE</code>) part of this picture. Reading objects from a database server into a client's (transient) address space requires a container object to - hold the data in question. Though <trademark - xlink:href="http://www.oracle.com/us/legal/third-party-trademarks/index.html">Java</trademark> - offers standard container interfaces like + hold the data in question. Though <link + linkend="gloss_Java"><trademark>Java</trademark></link> offers + standard container interfaces like <classname>java.util.List</classname> the <trademark xlink:href="http://electronics.zibb.com/trademark/jdbc/29545026">JDBC</trademark> standard has created separate specifications like @@ -12391,9 +12427,9 @@ public class SimpleRead { <callout arearefs="listingJdbcRead-3-co listingJdbcRead-4-co listingJdbcRead-5-co" xml:id="listingJdbcRead-3"> <para>The access methods have to be chosen according to matching - types. An overview of database/<trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark> - type mappings is being given in <uri + types. An overview of database/<link + linkend="gloss_Java"><trademark>Java</trademark></link> type + mappings is being given in <uri xlink:href="http://docs.oracle.com/javase/1.3/docs/guide/jdbc/getstart/mapping.html">http://docs.oracle.com/javase/1.3/docs/guide/jdbc/getstart/mapping.html</uri>.</para> </callout> </calloutlist> @@ -12712,11 +12748,12 @@ public class HashProvider { ...}</programlisting> <para>We may test the two class methods - <methodname>sda.jdbc.intro.auth.HashProvider.getSaltedHash(char[])</methodname>(...) and - <methodname>sda.jdbc.intro.auth.HashProvider.check(char[],String)</methodname> by a separate driver - class. Notice the <quote>$</quote> sign <coref - linkend="saltPwhashSeparator"/> separating salt and password - hash:</para> + <methodname>sda.jdbc.intro.auth.HashProvider.getSaltedHash(char[])</methodname>(...) + and + <methodname>sda.jdbc.intro.auth.HashProvider.check(char[],String)</methodname> + by a separate driver class. Notice the <quote>$</quote> sign + <coref linkend="saltPwhashSeparator"/> separating salt and + password hash:</para> <programlisting language="java">package sda.jdbc.intro.auth; @@ -14929,8 +14966,8 @@ leader-pattern="dots"/>C<fo:leader leader-pattern="dots"/>D</fo:bloc </glossentry> <glossentry> - <glossterm><trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark>:</glossterm> + <glossterm><link + linkend="gloss_Java"><trademark>Java</trademark></link>:</glossterm> <glossdef> <para><code>import de.hdm-stuttgart.xml;</code></para> @@ -15517,9 +15554,9 @@ controlled for these purposes by the company.</para> linkend="bibKeith09"/>.</remark> <section xml:id="configureEclipseMaven"> - <title>Configuring a Maven based Eclipse <trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark> - project with Hibernate</title> + <title>Configuring a Maven based Eclipse <link + linkend="gloss_Java"><trademark>Java</trademark></link> project with + Hibernate</title> <para>We will use Maven for several purposes:</para> @@ -15600,8 +15637,8 @@ controlled for these purposes by the company.</para> <listitem> <para>We select <quote>maven-archetype-quickstart</quote> to - choose a plain <trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark> + choose a plain <link + linkend="gloss_Java"><trademark>Java</trademark></link> project</para> <informalfigure> @@ -15628,9 +15665,9 @@ controlled for these purposes by the company.</para> </listitem> <listitem> - <para>We end up with a <trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark> - project already being enabled for <productname + <para>We end up with a <link + linkend="gloss_Java"><trademark>Java</trademark></link> project + already being enabled for <productname xlink:href="http://www.junit.org">Junit</productname> testing.</para> @@ -15681,8 +15718,8 @@ controlled for these purposes by the company.</para> <orderedlist> <listitem> <para>Searching for <quote>mysql</quote> in a maven repository - yields the <trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark> + yields the <link + linkend="gloss_Java"><trademark>Java</trademark></link> <trademark xlink:href="http://www.oracle.com/technetwork/java/javase/jdbc">JDBC</trademark> connector:</para> @@ -15781,9 +15818,9 @@ controlled for these purposes by the company.</para> <title>Creating a Hibernate configuration</title> <para>Hibernate is intended to provide persistence services saving - transient <trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark> - instances to a database. For this purpose Hibernate needs:</para> + transient <link + linkend="gloss_Java"><trademark>Java</trademark></link> instances to + a database. For this purpose Hibernate needs:</para> <itemizedlist> <listitem> @@ -15874,12 +15911,11 @@ controlled for these purposes by the company.</para> <section xml:id="sect_hibernateBasics"> <title>A round trip working with objects</title> - <para>Hibernate may be regarded as a persistence provider to <abbrev - xlink:href="http://www.javaworld.com/javaworld/jw-01-2008/jw-01-jpa1.html">JPA</abbrev>:</para> + <para>Hibernate may be regarded as a persistence provider to <link + linkend="gloss_JPA"><abbrev>JPA</abbrev></link>:</para> <figure xml:id="jpaPersistProvider"> - <title><abbrev - xlink:href="http://www.javaworld.com/javaworld/jw-01-2008/jw-01-jpa1.html">JPA</abbrev> + <title><link linkend="gloss_JPA"><abbrev>JPA</abbrev></link> persistence provider</title> <mediaobject> @@ -15889,12 +15925,11 @@ controlled for these purposes by the company.</para> </mediaobject> </figure> - <para>Having configured Hibernate we may now start working with - <trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark> - objects. To do so we need an appropriate session object to run - transactions. Starting from the Hibernate documentation we code the - following helper method:</para> + <para>Having configured Hibernate we may now start working with <link + linkend="gloss_Java"><trademark>Java</trademark></link> objects. To do + so we need an appropriate session object to run transactions. Starting + from the Hibernate documentation we code the following helper + method:</para> <programlisting>package hibintro.util; @@ -15979,10 +16014,10 @@ public class User { In <xref linkend="jdbcIntro"/> we introduced the <trademark xlink:href="http://www.oracle.com/technetwork/java/javase/jdbc">JDBC</trademark> <abbrev xlink:href="http://en.wikipedia.org/wiki/Api">API</abbrev> - connecting <trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark> - applications and relational database systems. We stored and - retrieved object values.</para> + connecting <link + linkend="gloss_Java"><trademark>Java</trademark></link> applications + and relational database systems. We stored and retrieved object + values.</para> <para>Having larger projects these tasks become increasingly tedious. It is thus desired to automate these tasks while still @@ -16120,8 +16155,7 @@ import javax.persistence.Entity; <para>The careful reader will have noticed that we've annotated the getter method rather than the property <code>uid</code> itself. - Hibernate / <abbrev - xlink:href="http://www.javaworld.com/javaworld/jw-01-2008/jw-01-jpa1.html">JPA</abbrev> + Hibernate / <link linkend="gloss_JPA"><abbrev>JPA</abbrev></link> can work both ways. Annotating a getter however offers additional support e.g. when logging for debugging purposes is required.</para> @@ -16252,9 +16286,10 @@ Exception in thread "main" org.hibernate.ObjectNotFoundException: <co <classname>org.hibernate.ObjectNotFoundException</classname>.</para> <para>The documentation also tells us to use the - corresponding <methodname>org.hibernate.Session.get(Class,Serializable)</methodname> method which - actually returns <code>null</code> in case a primary key - value does not exist:</para> + corresponding + <methodname>org.hibernate.Session.get(Class,Serializable)</methodname> + method which actually returns <code>null</code> in case a + primary key value does not exist:</para> <programlisting>... final User u = (User) session.get(User.class, "goik2"); if (null == u ) { @@ -16781,14 +16816,14 @@ public class Project { </calloutlist> <qandaset role="exercise"> - <title><abbrev - xlink:href="http://www.javaworld.com/javaworld/jw-01-2008/jw-01-jpa1.html">JPA</abbrev> + <title><link linkend="gloss_JPA"><abbrev>JPA</abbrev></link> requirements.</title> <qandadiv> <qandaentry> <question> - <para>The setter void <methodname annotations="nojavadoc">setId(int)</methodname>in + <para>The setter void <methodname + annotations="nojavadoc">setId(int)</methodname>in <classname>hibintro.v6.Project</classname> has protected access. Explain this choice.</para> </question> @@ -16821,21 +16856,20 @@ public class Project { <para>From the viewpoint of software modelling non-unique indexes are not part of the business logic but refer to database - optimization. Consequently <abbrev - xlink:href="http://www.javaworld.com/javaworld/jw-01-2008/jw-01-jpa1.html">JPA</abbrev> - has no support for non-unique indexes.</para> + optimization. Consequently <link + linkend="gloss_JPA"><abbrev>JPA</abbrev></link> has no support for + non-unique indexes.</para> <para>On the other hand performance matters. Hibernate and other - persistence providers offer vendor specific <abbrev - xlink:href="http://www.javaworld.com/javaworld/jw-01-2008/jw-01-jpa1.html">JPA</abbrev> - extensions. We may find it useful to access - <classname>hibintro.v5.User</classname> instances having a specific - <code>cname</code> quickly. This can be achieved by adding a - Hibernate specific + persistence providers offer vendor specific <link + linkend="gloss_JPA"><abbrev>JPA</abbrev></link> extensions. We may + find it useful to access <classname>hibintro.v5.User</classname> + instances having a specific <code>cname</code> quickly. This can be + achieved by adding a Hibernate specific <code>org.hibernate.annotations.</code><classname>org.hibernate.annotations.Table</classname> index generating annotation <coref - linkend="hibernateExtensionIndex"/> which works on top of <abbrev - xlink:href="http://www.javaworld.com/javaworld/jw-01-2008/jw-01-jpa1.html">JPA</abbrev>'s + linkend="hibernateExtensionIndex"/> which works on top of <link + linkend="gloss_JPA"><abbrev>JPA</abbrev></link>'s <code>javax.persistence.</code><classname>javax.persistence.Table</classname>:</para> <informaltable border="1"> @@ -16880,15 +16914,15 @@ CREATE INDEX findCname ON User (cname ASC);</programlisting></td> <title>Renaming tables and attributes</title> <para>So far we assumed that we map classes to database tables - having identical names: A <trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark> - class <code>User</code> is being mapped to a relational table with + having identical names: A <link + linkend="gloss_Java"><trademark>Java</trademark></link> class + <code>User</code> is being mapped to a relational table with identical name <code>User</code>. Sometimes a renaming is desired. We may for example want to access a legacy database by a newly - implemented <trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark> - application. Choosing meaningful names may conflict with decisions - being taken when the original database design took place.</para> + implemented <link + linkend="gloss_Java"><trademark>Java</trademark></link> application. + Choosing meaningful names may conflict with decisions being taken + when the original database design took place.</para> <para>In the following example we change the database tables name from its default User to Person <coref @@ -16947,9 +16981,9 @@ public class User { <section xml:id="sectChangeDefaultTypeMapping"> <title>Changing the default type mapping</title> - <para>Sometimes we are interested in changing <abbrev - xlink:href="http://www.javaworld.com/javaworld/jw-01-2008/jw-01-jpa1.html">JPA</abbrev>'s - default type mapping strategy. For example <trademark + <para>Sometimes we are interested in changing <link + linkend="gloss_JPA"><abbrev>JPA</abbrev></link>'s default type + mapping strategy. For example <trademark xlink:href="http://www.mysql.com/about/legal/trademark.html">Mysql</trademark> versions prior to 5.0 lack an appropriate type representing boolean values. It was therefore quite common mapping boolean properties to @@ -16958,13 +16992,13 @@ public class User { <code>tinyint(1)</code>. Supporting older software may require to tweak the standard mapping.</para> - <para>Unfortunately <abbrev - xlink:href="http://www.javaworld.com/javaworld/jw-01-2008/jw-01-jpa1.html">JPA</abbrev> - itself does not offer any interface for this purpose. The - persistence provider may offer a solution though. Hibernate for - example allows to remap <coref linkend="remapBooleanChar"/> types . - We assume our <classname>hibintro.v9.User</classname> class to have - a <code>boolean</code> property <code>active</code>:</para> + <para>Unfortunately <link + linkend="gloss_JPA"><abbrev>JPA</abbrev></link> itself does not + offer any interface for this purpose. The persistence provider may + offer a solution though. Hibernate for example allows to remap + <coref linkend="remapBooleanChar"/> types . We assume our + <classname>hibintro.v9.User</classname> class to have a + <code>boolean</code> property <code>active</code>:</para> <informaltable border="1"> <colgroup width="6%"/> @@ -17151,18 +17185,16 @@ public class BankAccount extends BillingDetails { <callout arearefs="billingMapSingleTable" xml:id="billingMapSingleTableCallout"> <para>All classes of the inheritance hierarchy will be mapped to - a single table. Unless stated otherwise the <abbrev - xlink:href="http://www.javaworld.com/javaworld/jw-01-2008/jw-01-jpa1.html">JPA</abbrev> - provider will choose the root class' name - (<code>BillingDetails</code>) as default value for the generated - relation's name <coref + a single table. Unless stated otherwise the <link + linkend="gloss_JPA"><abbrev>JPA</abbrev></link> provider will + choose the root class' name (<code>BillingDetails</code>) as + default value for the generated relation's name <coref linkend="BillingDetailsGeneratedRelationName"/>.</para> </callout> <callout arearefs="billingMapSingleTableDiscriminator" xml:id="billingMapSingleTableDiscriminatorCallout"> - <para>The <abbrev - xlink:href="http://www.javaworld.com/javaworld/jw-01-2008/jw-01-jpa1.html">JPA</abbrev> + <para>The <link linkend="gloss_JPA"><abbrev>JPA</abbrev></link> provider needs a column to distinguish the different types of database objects. We've chosen the discriminator attribute <code>dataType</code> values to be simple strings. Due to the @@ -17617,8 +17649,7 @@ public class RetrieveAll { </informaltable> <qandaset role="exercise"> - <title><abbrev - xlink:href="http://www.javaworld.com/javaworld/jw-01-2008/jw-01-jpa1.html">JPA</abbrev> + <title><link linkend="gloss_JPA"><abbrev>JPA</abbrev></link> constraints and database integrity.</title> <qandadiv> @@ -17627,8 +17658,8 @@ public class RetrieveAll { <para>Explain all integrity constraints of the Hibernate generated schema. Is it able to implement the correct constraints on database level corresponding to the - inheritance related <trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark> + inheritance related <link + linkend="gloss_Java"><trademark>Java</trademark></link> objects? On contrary: Are there possible database states which do not correspond to the domain model's object constraints?</para> @@ -17702,8 +17733,8 @@ CREATE TABLE BankAccount ( </calloutlist> <para>The NOT NULL constraints implement their counterpart - properties in the corresponding <trademark - xlink:href="http://www.oracle.com/us/technologies/java">Java</trademark> + properties in the corresponding <link + linkend="gloss_Java"><trademark>Java</trademark></link> objects.</para> <para>The mapping does not cover one important integrity @@ -17768,7 +17799,7 @@ CREATE TABLE BankAccount ( <itemizedlist> <listitem> - <para>A primary key's values never change </para> + <para>A primary key's values never change</para> </listitem> <listitem> @@ -17805,10 +17836,50 @@ CREATE TABLE BankAccount ( </glossentry> <glossentry> - <glossterm/> + <glossterm>Database identity</glossterm> + + <glossdef> + <para>Two distinct datasets (tuples) are identical if all + primary key attributes have the same value.</para> + + <para>In other words: Two distinct database objects differ at + least in one primary key attribute.</para> + </glossdef> + </glossentry> + </glosslist> + + <section xml:id="objectEqualityByPrimaryKey"> + <title>Defining object equality by primary key</title> + + <para>Since JPA entities require a</para> + </section> + </section> + + <section xml:id="entityValueTypes"> + <title>Entity and value types</title> + + <para>From the viewpoint of <link linkend="gloss_ORM">ORM</link> we + distinguish two distinct types of database objects:</para> + + <glosslist> + <glossentry> + <glossterm>Entity type</glossterm> + + <glossdef> + <para>Objects of this type do have their own database identity + and may exist independently of other (database) + entities.</para> + </glossdef> + </glossentry> + + <glossentry> + <glossterm>Value type</glossterm> <glossdef> - <para/> + <para>An object of value type has no database identity. It + will appear in a database as a composite of a parent entity + type. Its lifecycle is completely dependent on its + parent.</para> </glossdef> </glossentry> </glosslist> -- GitLab