jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukas Kahwe Smith <...@pooteeweet.org>
Subject Re: SQL2 and references
Date Fri, 30 Sep 2011 09:05:54 GMT

On Sep 28, 2011, at 01:15 , Mark Herman wrote:

> 
> Lukas Kahwe Smith wrote:
>> 
>> 
>> <D:searchrequest xmlns:D="DAV:"><JCR-SQL2></JCR-SQL2></D:searchrequest>
>> 
>> 
> 
> I'm a bit confused about the use of "reference" but i was able to get
> results using the property name. I dont' know if "reference" a special word
> or just an example of a property name.  Here is my query that does return a
> result:
> 
> SELECT * FROM [nt:unstructured] AS data INNER JOIN [nt:unstructured] AS
> referring ON referring.[dong] = data.[jcr:uuid] WHERE data.lala= 'huii'
> 
> I tried to get the data set up how you explained it, just in case, here is
> mine:
> 
> /foo [nt:unstructured]
> /foo/bar [nt:unstructured]
> /foo/bar@lala = huii (lala is string property of bar)
> /ding [nt:unstructured]
> /ding@dong = ##barUUID### (dong is a property of type "Reference")


I did my very best trying to reproduce the issue with java (not really my native language).

DavexClient Client = new DavexClient(url);
Repository repo = Client.getRepository();
Credentials sc = new SimpleCredentials("admin","admin".toCharArray());
Session s = repo.login(sc,workspace);

QueryManager qm = s.getWorkspace().getQueryManager();

String sql = "SELECT data.* FROM [nt:unstructured] AS data WHERE data.lala= 'huii'";
sql = "SELECT * FROM [nt:unstructured] AS data INNER JOIN [nt:unstructured] AS referring ON
referring.[dong] = data.[jcr:uuid] WHERE data.lala = 'huii'";
sql = "SELECT * FROM [nt:unstructured] AS data INNER JOIN [nt:unstructured] AS referring ON
ISDESCENDANTNODE(data, referring) WHERE data.lala = 'huii'";
Query query = qm.createQuery(sql, Query.JCR_SQL2);
QueryResult qr = query.execute();

The first query works just fine and I can iterate over the result. Neither the second nor
the third query works.
In both cases I end up with a javax.jcr.RepositoryException

@Jukka: could this really mean that JOIN's simply do not work via Davex?

regards,
Lukas Kahwe Smith
mls@pooteeweet.org




Mime
View raw message