http://git-wip-us.apache.org/repos/asf/isis-site/blob/87081dfe/content/versions/SNAPSHOT/guides/rgcfg/rgcfg.pdf
----------------------------------------------------------------------
diff --git a/content/versions/SNAPSHOT/guides/rgcfg/rgcfg.pdf 
b/content/versions/SNAPSHOT/guides/rgcfg/rgcfg.pdf
index cc4e3ce..fa9622a 100644
--- a/content/versions/SNAPSHOT/guides/rgcfg/rgcfg.pdf
+++ b/content/versions/SNAPSHOT/guides/rgcfg/rgcfg.pdf
@@ -4,8 +4,8 @@
 << /Title 
<feff0043006f0072006500200043006f006e0066006900672019006e002000500072006f0070006500720074006900650073>
 /Creator (Asciidoctor PDF 1.5.0.alpha.11, based on Prawn 1.3.0)
 /Producer (Asciidoctor PDF 1.5.0.alpha.11, based on Prawn 1.3.0)
-/CreationDate (D:20180213222757+00'00')
-/ModDate (D:20180213222757+00'00')
+/CreationDate (D:20180214103830+00'00')
+/ModDate (D:20180214103830+00'00')
 >>
 endobj
 2 0 obj

http://git-wip-us.apache.org/repos/asf/isis-site/blob/87081dfe/content/versions/SNAPSHOT/guides/rgcms/rgcms.pdf
----------------------------------------------------------------------
diff --git a/content/versions/SNAPSHOT/guides/rgcms/rgcms.pdf 
b/content/versions/SNAPSHOT/guides/rgcms/rgcms.pdf
index 732a4cb..01dc19a 100644
--- a/content/versions/SNAPSHOT/guides/rgcms/rgcms.pdf
+++ b/content/versions/SNAPSHOT/guides/rgcms/rgcms.pdf
@@ -4,8 +4,8 @@
 << /Title (Classes, Methods and Schema)
 /Creator (Asciidoctor PDF 1.5.0.alpha.11, based on Prawn 1.3.0)
 /Producer (Asciidoctor PDF 1.5.0.alpha.11, based on Prawn 1.3.0)
-/CreationDate (D:20180213222801+00'00')
-/ModDate (D:20180213222801+00'00')
+/CreationDate (D:20180214103834+00'00')
+/ModDate (D:20180214103834+00'00')
 >>
 endobj
 2 0 obj

http://git-wip-us.apache.org/repos/asf/isis-site/blob/87081dfe/content/versions/SNAPSHOT/guides/rgfis/rgfis.pdf
----------------------------------------------------------------------
diff --git a/content/versions/SNAPSHOT/guides/rgfis/rgfis.pdf 
b/content/versions/SNAPSHOT/guides/rgfis/rgfis.pdf
index c59fb2e..487eb99 100644
--- a/content/versions/SNAPSHOT/guides/rgfis/rgfis.pdf
+++ b/content/versions/SNAPSHOT/guides/rgfis/rgfis.pdf
@@ -4,8 +4,8 @@
 << /Title (Framework Internal Services)
 /Creator (Asciidoctor PDF 1.5.0.alpha.11, based on Prawn 1.3.0)
 /Producer (Asciidoctor PDF 1.5.0.alpha.11, based on Prawn 1.3.0)
-/CreationDate (D:20180213222825+00'00')
-/ModDate (D:20180213222825+00'00')
+/CreationDate (D:20180214103859+00'00')
+/ModDate (D:20180214103859+00'00')
 >>
 endobj
 2 0 obj

http://git-wip-us.apache.org/repos/asf/isis-site/blob/87081dfe/content/versions/SNAPSHOT/guides/rgmvn/rgmvn.pdf
----------------------------------------------------------------------
diff --git a/content/versions/SNAPSHOT/guides/rgmvn/rgmvn.pdf 
b/content/versions/SNAPSHOT/guides/rgmvn/rgmvn.pdf
index 56522f7..64a30df 100644
--- a/content/versions/SNAPSHOT/guides/rgmvn/rgmvn.pdf
+++ b/content/versions/SNAPSHOT/guides/rgmvn/rgmvn.pdf
@@ -4,8 +4,8 @@
 << /Title (Apache Isis Maven plugin)
 /Creator (Asciidoctor PDF 1.5.0.alpha.11, based on Prawn 1.3.0)
 /Producer (Asciidoctor PDF 1.5.0.alpha.11, based on Prawn 1.3.0)
-/CreationDate (D:20180213222830+00'00')
-/ModDate (D:20180213222830+00'00')
+/CreationDate (D:20180214103904+00'00')
+/ModDate (D:20180214103904+00'00')
 >>
 endobj
 2 0 obj

http://git-wip-us.apache.org/repos/asf/isis-site/blob/87081dfe/content/versions/SNAPSHOT/guides/rgsvc/rgsvc.pdf
----------------------------------------------------------------------
diff --git a/content/versions/SNAPSHOT/guides/rgsvc/rgsvc.pdf 
b/content/versions/SNAPSHOT/guides/rgsvc/rgsvc.pdf
index d12145c..d4c1199 100644
--- a/content/versions/SNAPSHOT/guides/rgsvc/rgsvc.pdf
+++ b/content/versions/SNAPSHOT/guides/rgsvc/rgsvc.pdf
@@ -4,8 +4,8 @@
 << /Title (Domain Services)
 /Creator (Asciidoctor PDF 1.5.0.alpha.11, based on Prawn 1.3.0)
 /Producer (Asciidoctor PDF 1.5.0.alpha.11, based on Prawn 1.3.0)
-/CreationDate (D:20180213222835+00'00')
-/ModDate (D:20180213222835+00'00')
+/CreationDate (D:20180214103909+00'00')
+/ModDate (D:20180214103909+00'00')
 >>
 endobj
 2 0 obj

http://git-wip-us.apache.org/repos/asf/isis-site/blob/87081dfe/content/versions/SNAPSHOT/guides/ugbtb/ugbtb.pdf
----------------------------------------------------------------------
diff --git a/content/versions/SNAPSHOT/guides/ugbtb/ugbtb.pdf 
b/content/versions/SNAPSHOT/guides/ugbtb/ugbtb.pdf
index 064fa31..f4e4126 100644
--- a/content/versions/SNAPSHOT/guides/ugbtb/ugbtb.pdf
+++ b/content/versions/SNAPSHOT/guides/ugbtb/ugbtb.pdf
@@ -4,8 +4,8 @@
 << /Title (Beyond the Basics)
 /Creator (Asciidoctor PDF 1.5.0.alpha.11, based on Prawn 1.3.0)
 /Producer (Asciidoctor PDF 1.5.0.alpha.11, based on Prawn 1.3.0)
-/CreationDate (D:20180213222914+00'00')
-/ModDate (D:20180213222914+00'00')
+/CreationDate (D:20180214103949+00'00')
+/ModDate (D:20180214103949+00'00')
 >>
 endobj
 2 0 obj

http://git-wip-us.apache.org/repos/asf/isis-site/blob/87081dfe/content/versions/SNAPSHOT/guides/ugfun/ugfun.pdf
----------------------------------------------------------------------
diff --git a/content/versions/SNAPSHOT/guides/ugfun/ugfun.pdf 
b/content/versions/SNAPSHOT/guides/ugfun/ugfun.pdf
index 52dfc4f..91cfe55 100644
--- a/content/versions/SNAPSHOT/guides/ugfun/ugfun.pdf
+++ b/content/versions/SNAPSHOT/guides/ugfun/ugfun.pdf
@@ -4,8 +4,8 @@
 << /Title (Fundamentals)
 /Creator (Asciidoctor PDF 1.5.0.alpha.11, based on Prawn 1.3.0)
 /Producer (Asciidoctor PDF 1.5.0.alpha.11, based on Prawn 1.3.0)
-/CreationDate (D:20180213222929+00'00')
-/ModDate (D:20180213222929+00'00')
+/CreationDate (D:20180214104004+00'00')
+/ModDate (D:20180214104004+00'00')
 >>
 endobj
 2 0 obj

http://git-wip-us.apache.org/repos/asf/isis-site/blob/87081dfe/content/versions/SNAPSHOT/guides/ugodn/ugodn.html
----------------------------------------------------------------------
diff --git a/content/versions/SNAPSHOT/guides/ugodn/ugodn.html 
b/content/versions/SNAPSHOT/guides/ugodn/ugodn.html
index ad56901..90b5629 100644
--- a/content/versions/SNAPSHOT/guides/ugodn/ugodn.html
+++ b/content/versions/SNAPSHOT/guides/ugodn/ugodn.html
@@ -2005,6 +2005,106 @@ 
isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=</code></pre
           </table> 
          </div> 
         </div> 
+        <div class="sect2"> 
+         <h3 id="_ugodn_hints-and-tips_jdoql-and-timestamps">5.6. JDOQL and 
Timestamps</h3>
+         <div class="btn-group" style="float: right; font-size: small; 
padding: 6px; margin-top: -55px; ">
+          <button type="button" class="btn btn-xs btn-default" 
onclick="window.location.href=&quot;https://github.com/apache/isis/edit/master/adocs/documentation/src/main/asciidoc/guides/ugodn/_ugodn_hints-and-tips_jdoql-and-timestamps.adoc&quot;";><i
 class="fa fa-pencil-square-o"></i>&nbsp;Edit</button>
+          <button type="button" class="btn btn-xs btn-default dropdown-toggle" 
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span 
class="caret"></span><span class="sr-only">Toggle Dropdown</span></button>
+          <ul class="dropdown-menu">
+           <li><a 
href="https://github.com/apache/isis/edit/master/adocs/documentation/src/main/asciidoc/guides/ugodn/_ugodn_hints-and-tips_jdoql-and-timestamps.adoc";
 target="_blank"><i class="fa fa-pencil-square-o fa-fw" 
aria-hidden="true"></i>&nbsp; Edit</a></li>
+           <li><a 
href="https://github.com/apache/isis/commits/master/adocs/documentation/src/main/asciidoc/guides/ugodn/_ugodn_hints-and-tips_jdoql-and-timestamps.adoc";
 target="_blank"><i class="fa fa-clock-o fa-fw" aria-hidden="true"></i>&nbsp; 
History</a></li>
+           <li><a 
href="https://github.com/apache/isis/raw/master/adocs/documentation/src/main/asciidoc/guides/ugodn/_ugodn_hints-and-tips_jdoql-and-timestamps.adoc";
 target="_blank"><i class="fa fa-file-text-o fa-fw" 
aria-hidden="true"></i>&nbsp; Raw</a></li>
+           <li><a 
href="https://github.com/apache/isis/blame/master/adocs/documentation/src/main/asciidoc/guides/ugodn/_ugodn_hints-and-tips_jdoql-and-timestamps.adoc";
 target="_blank"><i class="fa fa-hand-o-right fa-fw" 
aria-hidden="true"></i>&nbsp; Blame</a></li>
+          </ul>
+         </div> 
+         <div class="paragraph"> 
+          <p>Beware of entities with a property called "timestamp": you run 
the risk of "timestamp" being treated as a keyword in certain contexts, 
probably not as you intended.</p> 
+         </div> 
+         <div class="paragraph"> 
+          <p>By way of example, the (non-ASF) <a 
href="http://platform.incode.org";>Incode Platform</a>'s command module has an 
entity called <code>CommandJdo</code>. This has a property called "timestamp", 
of type <code>java.sql.Timestamp</code>.</p> 
+         </div> 
+         <div class="paragraph"> 
+          <p>This defines a query using JDOQL:</p> 
+         </div> 
+         <div class="listingblock"> 
+          <div class="content"> 
+           <pre class="CodeRay highlight"><code data-lang="java">SELECT
+FROM org.isisaddons.module.command.dom.CommandJdo
+WHERE executeIn == <span class="string"><span class="delimiter">'</span><span 
class="content">FOREGROUND</span><span class="delimiter">'</span></span>
+   &amp;&amp; timestamp &gt; :timestamp
+   &amp;&amp; startedAt != <span class="predefined-constant">null</span>
+   &amp;&amp; completedAt != <span class="predefined-constant">null</span>
+ORDER BY timestamp ASC</code></pre> 
+          </div> 
+         </div> 
+         <div class="paragraph"> 
+          <p>This is declared using a JDO <code>@Query</code>; no errors are 
thrown at any stage.</p> 
+         </div> 
+         <div class="paragraph"> 
+          <p>However, running this query against SQL Server 2016 produced a 
different result first time it was run compared to subsequent times.</p> 
+         </div> 
+         <div class="paragraph"> 
+          <p>Running SQL Profiler showed the underlying SQL as:</p> 
+         </div> 
+         <div class="listingblock"> 
+          <div class="content"> 
+           <pre class="CodeRay highlight"><code data-lang="sql">exec 
sp_prepexec <span class="variable">@p1</span> output,<span class="string"><span 
class="modifier">N</span><span class="delimiter">'</span><span 
class="content">@P0 datetime2</span><span class="delimiter">'</span></span>,
+<span class="string"><span class="modifier">N</span><span 
class="delimiter">'</span><span class="content">SELECT 
''org.isisaddons.module.command.dom.CommandJdo'' AS NUCLEUS_TYPE, A0.arguments, 
..., A0.target, A0."timestamp", A0.transactionId, A0."user", ''2018-01-24 
17:29:18.3'' AS NUCORDER0 <i class="conum" data-value="1"></i><b>(1)</b> FROM 
isiscommand.Command A0 WHERE A0.executeIn = ''FOREGROUND'' AND A0."timestamp" 
&gt; @P0 AND A0.startedAt IS NOT NULL AND A0.completedAt IS NOT NULL ORDER BY 
NUCORDER0 OFFSET 0 ROWS FETCH NEXT 2 ROWS ONLY </span><span 
class="delimiter">'</span></span>,   <i class="conum" 
data-value="2"></i><b>(2)</b>
+<span class="string"><span class="delimiter">'</span><span 
class="content">2018-01-24 17:29:18.3000000</span><span 
class="delimiter">'</span></span>               <i class="conum" 
data-value="3"></i><b>(3)</b></code></pre> 
+          </div> 
+         </div> 
+         <div class="colist arabic"> 
+          <table> 
+           <tbody>
+            <tr> 
+             <td><i class="conum" data-value="1"></i><b>1</b></td> 
+             <td>discussed below …​ this is the issue</td> 
+            </tr> 
+            <tr> 
+             <td><i class="conum" data-value="2"></i><b>2</b></td> 
+             <td>because the query is submitted with max rows programmatically 
set to 2.</td> 
+            </tr> 
+            <tr> 
+             <td><i class="conum" data-value="3"></i><b>3</b></td> 
+             <td>argument for @P0 (the timestamp parametr)</td> 
+            </tr> 
+           </tbody>
+          </table> 
+         </div> 
+         <div class="paragraph"> 
+          <p>To unpick this, the key issue is the <code>NUCORDER0</code> 
column, which is then used in the <code>ORDER BY</code>. However, because this 
is a literal value, the effect is no defined ordering.</p> 
+         </div> 
+         <div class="paragraph"> 
+          <p>The problem therefore is that in the JDOQL the "ORDER BY 
timestamp ASC", the "timestamp" is being evaluated as the current time - a 
built-in function.</p> 
+         </div> 
+         <div class="paragraph"> 
+          <p>My fix was to change the JDOQL to be:</p> 
+         </div> 
+         <div class="listingblock"> 
+          <div class="content"> 
+           <pre class="CodeRay highlight"><code data-lang="sql"><span 
class="class">SELECT</span>
+<span class="keyword">FROM</span> org.isisaddons.module.command.dom.CommandJdo
+<span class="keyword">WHERE</span> executeIn == <span class="string"><span 
class="delimiter">'</span><span class="content">FOREGROUND</span><span 
class="delimiter">'</span></span>
+   &amp;&amp; <span class="predefined-type">timestamp</span> &gt; :<span 
class="predefined-type">timestamp</span>
+   &amp;&amp; startedAt != <span class="predefined-constant">null</span>
+   &amp;&amp; completedAt != <span class="predefined-constant">null</span>
+<span class="keyword">ORDER</span> <span class="keyword">BY</span> 
this.timestamp <span class="directive">ASC</span>             <i class="conum" 
data-value="1"></i><b>(1)</b></code></pre> 
+          </div> 
+         </div> 
+         <div class="colist arabic"> 
+          <table> 
+           <tbody>
+            <tr> 
+             <td><i class="conum" data-value="1"></i><b>1</b></td> 
+             <td>Use "this." to qualify the timestamp</td> 
+            </tr> 
+           </tbody>
+          </table> 
+         </div> 
+         <div class="paragraph"> 
+          <p>It wasn’t necessary to qualify the other occurances of 
"timestamp" (though it would be no harm to do so, either).</p> 
+         </div> 
+        </div> 
        </div> 
       </div> 
      </div> 

Reply via email to