4 Replies Latest reply: Mar 22, 2012 10:48 AM by Carsten Luxig RSS

JCR SQL2 Query Result empty if conditions are used

Carsten Luxig Newbie

Hello,

 

if have the following custom node types defined:

 

<docs='http://www.test.com/docs/1.0'>

[docs:metadata] > nt:unstructured
 -docs:test (long)

 

The nodes are created by an appropriate sequencer. After creation, i can retrieve the data from the repository (JpaSource) like this:

queryManager.createQuery("SELECT [docs:test] FROM [docs:metadata]", Query.JCR_SQL2).execute();

 

and get the following result:

+---+-----------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+
| # | docs:test | Location(docs:metadata)                                                                                                                                                                      | Score(docs:metadata) |
+---+-----------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+
| 1 | 5         | </{}xhtml+xml/{}1952ec12-39b6-448a-bb9e-e6938cda89ba/{http://www.test.com/ADELmetrology/1.0}metadata && [{http://www.modeshape.org/1.0}uuid = 239c500a-6efa-4467-83bf-c4ba9b2342b1]> | 0.11322011           |
+---+-----------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+

 

So the entry is in the repository. But now i try to use the following statements and all of them ends up in empty query result sets.

I assume, that i can do comparison like this for property type long.

SELECT [docs:test] FROM [docs:metadata] WHERE [docs:test] > 4
SELECT [docs:test] FROM [docs:metadata] WHERE [docs:test] = 5
SELECT [docs:test] FROM [docs:metadata] WHERE [docs:test] = '5'
SELECT [docs:test] FROM [docs:metadata] WHERE [docs:test] LIKE '5'

 

+---+-----------+-------------------------+----------------------+
| # | docs:test | Location(docs:metadata) | Score(docs:metadata) |
+---+-----------+-------------------------+----------------------+
+---+-----------+-------------------------+----------------------+

 

If i use this query, again i get the expected result shown above:

SELECT [docs:test] FROM [docs:metadata] WHERE [docs:test] LIKE '5%'

 

This is very strange and i can't understand it. Do you have any hints?

 

Regards, Carsten