<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Problem with CMIS query with int metadata in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/problem-with-cmis-query-with-int-metadata/m-p/86204#M26093</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a problem when tring to search an integer metadata with a CMIS query; in particular when try to use "IS NULL" predicate.&lt;/P&gt;&lt;P&gt;To test the issue you can run the integration tests in the project (based on Alfresco SDK 4) shared at URL:&amp;nbsp;&lt;A href="https://github.com/luca86r/alfresco-error-case-query-cmis-intfield" target="_blank" rel="noopener nofollow noreferrer"&gt;https://github.com/luca86r/alfresco-error-case-query-cmis-intfield&lt;/A&gt;&lt;/P&gt;&lt;P&gt;As you can see, the test alfresco.errorcase.query.cmis.intfield.platformsample.TestCaseErrorIT#testQueryNull() fails.&lt;/P&gt;&lt;P&gt;Essentialy the project:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;declares the new metadata acme:testInt of type d:int&lt;/LI&gt;&lt;LI&gt;defines a new Unit test class called TestCaseErrorIT&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The test class TestCaseErrorIT run 3 separated tests:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;testQuery0&lt;/STRONG&gt; [TEST OK]&lt;UL&gt;&lt;LI&gt;creates a new node setting the metadata acme:testInt to value 0&lt;/LI&gt;&lt;LI&gt;executes a CMIS query searching nodes with&amp;nbsp;acme:testInt = 0&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;testQuery1&lt;/STRONG&gt; [TEST OK]&lt;UL&gt;&lt;LI&gt;creates a new node setting the metadata acme:testInt to value 1&lt;/LI&gt;&lt;LI&gt;executes a CMIS query searching nodes with&amp;nbsp;acme:testInt = 1&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;testQueryNull&lt;/STRONG&gt;&amp;nbsp;[&lt;STRONG&gt;TEST KO&lt;/STRONG&gt;]&lt;UL&gt;&lt;LI&gt;creates a new node setting the metadata acme:testInt to null value&lt;/LI&gt;&lt;LI&gt;executes a CMIS query searching nodes with acme:testInt set to null&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I found that in&amp;nbsp;&lt;STRONG&gt;testQuery0()&lt;/STRONG&gt; and&amp;nbsp;&lt;STRONG&gt;testQuery1()&lt;/STRONG&gt;&amp;nbsp;the CMIS query is converted in the corresponding SQL query:&lt;/P&gt;&lt;PRE&gt;select node.id as id 
from alf_node node 
where node.type_qname_id &amp;lt;&amp;gt; ? 
AND node.store_id = ? 
AND ( node.type_qname_id IN ( ? ) ) 
AND node.id IN 
( 
select PROP.node_id 
from alf_node_properties PROP 
where (? = PROP.qname_id) AND PROP.long_value = ? 
) &lt;/PRE&gt;&lt;P&gt;Instead in &lt;STRONG&gt;testQueryNull()&lt;/STRONG&gt;&amp;nbsp;the CMIS query is converted in the corresponding SQL query:&lt;/P&gt;&lt;PRE&gt;select node.id as id 
from alf_node node 
where node.type_qname_id &amp;lt;&amp;gt; ? 
AND node.store_id = ? 
AND ( node.type_qname_id IN ( ? ) ) 
AND node.id NOT IN &lt;BR /&gt;( &lt;BR /&gt;select PROP.node_id &lt;BR /&gt;from alf_node_properties PROP &lt;BR /&gt;where (? = PROP.qname_id) AND &lt;STRONG&gt;PROP.long_value IS NOT NULL&lt;/STRONG&gt; &lt;BR /&gt;) &lt;/PRE&gt;&lt;P&gt;As I can see, Alfresco never set the DB column&amp;nbsp;&lt;STRONG&gt;alf_node_properties.long_value&lt;/STRONG&gt; to null. Instead Alfresco uses&amp;nbsp;&lt;STRONG&gt;alf_node_properties.actual_type_n &lt;/STRONG&gt;and&amp;nbsp;&lt;STRONG&gt;alf_node_properties.persisted_type_n&lt;/STRONG&gt; to store null value for an integer metadata and conseguentelly the query doesn't return the expected results. It's correct?&lt;/P&gt;&lt;P&gt;Is this a bug of CMIS query?&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;</description>
    <pubDate>Thu, 05 Dec 2019 14:47:10 GMT</pubDate>
    <dc:creator>luca_ow</dc:creator>
    <dc:date>2019-12-05T14:47:10Z</dc:date>
    <item>
      <title>Problem with CMIS query with int metadata</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/problem-with-cmis-query-with-int-metadata/m-p/86204#M26093</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a problem when tring to search an integer metadata with a CMIS query; in particular when try to use "IS NULL" predicate.&lt;/P&gt;&lt;P&gt;To test the issue you can run the integration tests in the project (based on Alfresco SDK 4) shared at URL:&amp;nbsp;&lt;A href="https://github.com/luca86r/alfresco-error-case-query-cmis-intfield" target="_blank" rel="noopener nofollow noreferrer"&gt;https://github.com/luca86r/alfresco-error-case-query-cmis-intfield&lt;/A&gt;&lt;/P&gt;&lt;P&gt;As you can see, the test alfresco.errorcase.query.cmis.intfield.platformsample.TestCaseErrorIT#testQueryNull() fails.&lt;/P&gt;&lt;P&gt;Essentialy the project:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;declares the new metadata acme:testInt of type d:int&lt;/LI&gt;&lt;LI&gt;defines a new Unit test class called TestCaseErrorIT&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The test class TestCaseErrorIT run 3 separated tests:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;testQuery0&lt;/STRONG&gt; [TEST OK]&lt;UL&gt;&lt;LI&gt;creates a new node setting the metadata acme:testInt to value 0&lt;/LI&gt;&lt;LI&gt;executes a CMIS query searching nodes with&amp;nbsp;acme:testInt = 0&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;testQuery1&lt;/STRONG&gt; [TEST OK]&lt;UL&gt;&lt;LI&gt;creates a new node setting the metadata acme:testInt to value 1&lt;/LI&gt;&lt;LI&gt;executes a CMIS query searching nodes with&amp;nbsp;acme:testInt = 1&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;testQueryNull&lt;/STRONG&gt;&amp;nbsp;[&lt;STRONG&gt;TEST KO&lt;/STRONG&gt;]&lt;UL&gt;&lt;LI&gt;creates a new node setting the metadata acme:testInt to null value&lt;/LI&gt;&lt;LI&gt;executes a CMIS query searching nodes with acme:testInt set to null&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I found that in&amp;nbsp;&lt;STRONG&gt;testQuery0()&lt;/STRONG&gt; and&amp;nbsp;&lt;STRONG&gt;testQuery1()&lt;/STRONG&gt;&amp;nbsp;the CMIS query is converted in the corresponding SQL query:&lt;/P&gt;&lt;PRE&gt;select node.id as id 
from alf_node node 
where node.type_qname_id &amp;lt;&amp;gt; ? 
AND node.store_id = ? 
AND ( node.type_qname_id IN ( ? ) ) 
AND node.id IN 
( 
select PROP.node_id 
from alf_node_properties PROP 
where (? = PROP.qname_id) AND PROP.long_value = ? 
) &lt;/PRE&gt;&lt;P&gt;Instead in &lt;STRONG&gt;testQueryNull()&lt;/STRONG&gt;&amp;nbsp;the CMIS query is converted in the corresponding SQL query:&lt;/P&gt;&lt;PRE&gt;select node.id as id 
from alf_node node 
where node.type_qname_id &amp;lt;&amp;gt; ? 
AND node.store_id = ? 
AND ( node.type_qname_id IN ( ? ) ) 
AND node.id NOT IN &lt;BR /&gt;( &lt;BR /&gt;select PROP.node_id &lt;BR /&gt;from alf_node_properties PROP &lt;BR /&gt;where (? = PROP.qname_id) AND &lt;STRONG&gt;PROP.long_value IS NOT NULL&lt;/STRONG&gt; &lt;BR /&gt;) &lt;/PRE&gt;&lt;P&gt;As I can see, Alfresco never set the DB column&amp;nbsp;&lt;STRONG&gt;alf_node_properties.long_value&lt;/STRONG&gt; to null. Instead Alfresco uses&amp;nbsp;&lt;STRONG&gt;alf_node_properties.actual_type_n &lt;/STRONG&gt;and&amp;nbsp;&lt;STRONG&gt;alf_node_properties.persisted_type_n&lt;/STRONG&gt; to store null value for an integer metadata and conseguentelly the query doesn't return the expected results. It's correct?&lt;/P&gt;&lt;P&gt;Is this a bug of CMIS query?&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 14:47:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/problem-with-cmis-query-with-int-metadata/m-p/86204#M26093</guid>
      <dc:creator>luca_ow</dc:creator>
      <dc:date>2019-12-05T14:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with CMIS query with int metadata</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/problem-with-cmis-query-with-int-metadata/m-p/86205#M26094</link>
      <description>&lt;P&gt;This looks like an issue.&lt;/P&gt;
&lt;P&gt;You can open it at &lt;A href="https://issues.alfresco.com" target="_blank" rel="nofollow noopener noreferrer"&gt;https://issues.alfresco.com&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 14:54:40 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/problem-with-cmis-query-with-int-metadata/m-p/86205#M26094</guid>
      <dc:creator>angelborroy</dc:creator>
      <dc:date>2019-12-05T14:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with CMIS query with int metadata</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/problem-with-cmis-query-with-int-metadata/m-p/86206#M26095</link>
      <description>&lt;P&gt;&lt;A href="https://issues.alfresco.com/jira/browse/ALF-22106" target="_blank" rel="nofollow noopener noreferrer"&gt;https://issues.alfresco.com/jira/browse/ALF-22106&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 16:32:37 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/problem-with-cmis-query-with-int-metadata/m-p/86206#M26095</guid>
      <dc:creator>luca_ow</dc:creator>
      <dc:date>2019-12-05T16:32:37Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with CMIS query with int metadata</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/problem-with-cmis-query-with-int-metadata/m-p/86207#M26096</link>
      <description>&lt;P&gt;In my eyes, the bug is the result of the stupid behaviour of Alfresco to actually store "null" at all. Setting a property to null should result in that property being deleted from the database, and in that case, the query would run successfully, as the result of the JOIN would find no matching alf_node_property row for the property in the first place.&lt;/P&gt;
&lt;P&gt;In various projects I have run Alfresco with a custom behaviour and/or AOP interceptor on the NodeDAO which makes sure that upon a property being set to null, it is actually deleted from the database instead. This avoids such nonsense bugs / issues and additionally improves performance of the database by not bloating it (each row adds static overhead, even if the value is null).&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 19:11:06 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/problem-with-cmis-query-with-int-metadata/m-p/86207#M26096</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2019-12-05T19:11:06Z</dc:date>
    </item>
  </channel>
</rss>

