From 23dff49b36f1cc47bcf8d22d6ad1cf42e9bcffc5 Mon Sep 17 00:00:00 2001 From: Martin Goik <goik@hdm-stuttgart.de> Date: Fri, 28 Nov 2014 07:45:35 +0100 Subject: [PATCH] CD exercice correction, long optimistic transaction example --- Sda2/sda2.xml | 101 ++++++++++++++++++++++++++++++-------------------- glossary.xml | 3 +- 2 files changed, 62 insertions(+), 42 deletions(-) diff --git a/Sda2/sda2.xml b/Sda2/sda2.xml index 345dc59ca..653d9c53f 100644 --- a/Sda2/sda2.xml +++ b/Sda2/sda2.xml @@ -92,7 +92,7 @@ </step> <step> - <para>Activate the <acronym>LDAP</acronym> perspective.</para> + <para>Activate the <xref linkend="glo_LDAP"/> perspective.</para> </step> <step> @@ -752,6 +752,38 @@ <para>Race conditions, time of check to time of use</para> </listitem> </itemizedlist> + + <qandaset defaultlabel="qanda" xml:id="qandaTransferOptimistic"> + <title>Optimistic account transfer</title> + + <qandadiv> + <qandaentry> + <question> + <para>Implement your (pessimistic) account transfer + application <xref linkend="qandaJdbcIsolation"/> in an + optimistic manner:</para> + + <itemizedlist> + <listitem> + <para>Make sure both source and destination accounts get + protected against interfering transactions.</para> + </listitem> + + <listitem> + <para>Provide a means to definitely avoid deadlocks during + the second transaction section of a balance transfer + operation.</para> + </listitem> + + <listitem> + <para>Supply a suitable message in case of an interfering + second balance transfer</para> + </listitem> + </itemizedlist> + </question> + </qandaentry> + </qandadiv> + </qandaset> </section> </section> </chapter> @@ -1507,16 +1539,11 @@ <para>Now we'd like to retrieve these objects. Hibernate offers the <emphasis role="bold">H</emphasis>ibernate <emphasis role="bold">Q</emphasis>uery <emphasis role="bold">L</emphasis>anguage - (<abbrev - xlink:href="http://docs.jboss.org/hibernate/orm/4.1/manual/en-US/html/ch16.html">HQL</abbrev>) - for object queries. As we will see <abbrev - xlink:href="http://docs.jboss.org/hibernate/orm/4.1/manual/en-US/html/ch16.html">HQL</abbrev> - extends <acronym - xlink:href="http://en.wikipedia.org/wiki/Sql">SQL</acronym> with - respect to polymorphic queries. The current example does not use - inheritance leaving us with a simple <abbrev - xlink:href="http://docs.jboss.org/hibernate/orm/4.1/manual/en-US/html/ch16.html">HQL</abbrev> - query <coref linkend="hqlFromUser"/> in + (<xref linkend="glo_HQL"/>) for object queries. As we will see <xref + linkend="glo_HQL"/> extends <acronym linkend="glo_SQL">SQL</acronym> + with respect to polymorphic queries. The current example does not use + inheritance leaving us with a simple <xref linkend="glo_HQL"/> query + <coref linkend="hqlFromUser"/> in <classname>hibintro.v1.run.RetrieveAll</classname>:</para> <figure xml:id="retrieveAllUserByHql"> @@ -1536,34 +1563,26 @@ }</programlisting> </figure> - <para>Being used to <acronym - xlink:href="http://en.wikipedia.org/wiki/Sql">SQL</acronym>we notice - the absence of a SELECT clause in <coref linkend="hqlFromUser"/>: The - ratio behind is having a focus on objects rather than on attribute - sets. Thus our <abbrev - xlink:href="http://docs.jboss.org/hibernate/orm/4.1/manual/en-US/html/ch16.html">HQL</abbrev> - query returns a set of <classname>hibintro.v1.model.User</classname> - instances:</para> + <para>Being used to <xref linkend="glo_SQL"/>we notice the absence of + a SELECT clause in <coref linkend="hqlFromUser"/>: The ratio behind is + having a focus on objects rather than on attribute sets. Thus our + <xref linkend="glo_HQL"/> query returns a set of + <classname>hibintro.v1.model.User</classname> instances:</para> <programlisting language="none">uid=eve, Eve Briggs uid=goik, Martin Goik uid=wings, Fred Wings</programlisting> <qandaset defaultlabel="qanda" xml:id="quandaentry_AnalyzeHqlResult"> - <title><abbrev - xlink:href="http://docs.jboss.org/hibernate/orm/4.1/manual/en-US/html/ch16.html">HQL</abbrev> - and <acronym - xlink:href="http://en.wikipedia.org/wiki/Sql">SQL</acronym>, + <title><xref linkend="glo_HQL"/> and <xref linkend="glo_SQL"/>, analyzing results.</title> <qandadiv> <qandaentry> <question> <para>We may actually retrieve attributes rather than objects. - For this purpose our query actually resembles standard - <acronym - xlink:href="http://en.wikipedia.org/wiki/Sql">SQL</acronym><coref - linkend="hqlWithSelect"/>:</para> + For this purpose our query actually resembles standard <xref + linkend="glo_SQL"/> <coref linkend="hqlWithSelect"/>:</para> <programlisting language="none">final Query searchUsers = session.createQuery("<emphasis role="bold">select uid, cname from User</emphasis>" <co @@ -1616,9 +1635,8 @@ xlink:href="http://docs.jboss.org/hibernate/orm/4.1/manual/en-US/html/ch16.html">HQL</abbrev> to offer additional features namely predicate based queries. Following <classname>hibintro.v1.run.SelectUser</classname> we may restrict our - result set by an <acronym - xlink:href="http://en.wikipedia.org/wiki/Sql">SQL</acronym> style - <code>WHERE</code> clause:</para> + result set by an <xref linkend="glo_SQL"/> style <code>WHERE</code> + clause:</para> <programlisting language="none"> final List<User> users = (List<User>) session.createQuery( "<emphasis role="bold">from User u where u.cname like '%e%'</emphasis>").list(); @@ -2220,7 +2238,8 @@ <title><xref linkend="glo_XML"/> to <xref linkend="glo_JPA"/> using <xref linkend="glo_JAXB"/></title> - <para>Consider the following Xml dataset example:</para> + <para>Consider the following <xref linkend="glo_XML"/> dataset + example:</para> <programlisting language="none"><catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="cd.xsd"> @@ -2335,10 +2354,11 @@ <listitem> <para>Use the <xref linkend="glo_JAXB"/> schema compiler <command - xlink:href="http://docs.oracle.com/javase/8/docs/technotes/tools/unix/xjc.html">xjc</command> - accordingly to create domain classes corresponding to - <tag class="starttag">catalog</tag> and <tag - class="starttag">year</tag> .</para> + xlink:href="http://docs.oracle.com/javase/8/docs/technotes/tools/unix/xjc.html"><xref + linkend="glo_xjc"/></command> accordingly to create + domain classes corresponding to <tag + class="starttag">catalog</tag> and <tag + class="starttag">cd</tag> .</para> </listitem> <listitem> @@ -2354,8 +2374,8 @@ <listitem> <para>Supply <xref linkend="glo_JPA"/> annotations to the <command - xlink:href="http://docs.oracle.com/javase/8/docs/technotes/tools/unix/xjc.html">xjc</command> - generated + xlink:href="http://docs.oracle.com/javase/8/docs/technotes/tools/unix/xjc.html"><xref + linkend="glo_xjc"/></command> generated <classname>de.hdm_stuttgart.mi.sda2.jpa.cd.domain.Catalog</classname> class.</para> </listitem> @@ -2668,10 +2688,9 @@ <para>Some Remarks: Our query asks for instances of <classname>inherit.v2.CreditCard</classname> <coref - linkend="hqlQueryCreditCard"/>. This gets implemented as an <acronym - xlink:href="http://en.wikipedia.org/wiki/Sql">SQL</acronym> - <code>SELECT</code> choosing datasets whose discriminator attribute - <code>value of dataType</code> <coref + linkend="hqlQueryCreditCard"/>. This gets implemented as an <xref + linkend="glo_SQL"/> <code>SELECT</code> choosing datasets whose + discriminator attribute <code>value of dataType</code> <coref linkend="hqlQueryCreditCard_dataType"/> equals <quote><code>Credit card</code></quote>. The current result set contains just one element <coref linkend="hqlQueryCreditCardResultSet"/> in accordance diff --git a/glossary.xml b/glossary.xml index 6ed589999..cd4211536 100644 --- a/glossary.xml +++ b/glossary.xml @@ -452,7 +452,8 @@ <glossterm>xjc</glossterm> <glossdef> - <para/> + <para><link xlink:href="https://jaxb.java.net/2.2.4/docs/xjc.html"> + Architecture for XML Binding Binding Compiler</link></para> </glossdef> </glossentry> -- GitLab