jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ross Gardler <rgard...@apache.org>
Subject Re: Testing for NotNull collection using OCM
Date Thu, 16 Jul 2009 22:41:19 GMT
2009/7/16 Christophe Lombart <christophe.lombart@gmail.com>:
> Can you check in the log (debug mode), the generated JCR query ? Maybe
> something is wrong with the generated query. Unfortunately, this method is
> not covered by the unit tests.

I can't believe I missed this in the logs but there is:

ERROR ocm.query.impl.FilterImpl getJcrFieldName - Impossible to find
the jcrFieldName for the attribute :rcs

However, I can't figure out why that is, my original post (below)
includes the relevant sections of the mapping.xml and class files. If
I'm not doing something stupid I'll provide a patch for the test cases
to reproduce the problem.

Ross

>
> 2009/7/14 Ross Gardler <rgardler@apache.org>
>
>> I'm having a problem with collections and OCM, I'm probably missing
>> something in the test code, but I've been struggling with this for a
>> couple of days now.
>>
>> In my mapping.xml I have:
>>
>>
>>
>>        <class-descriptor
>>                className="uk.ac.osswatch.simal.model.jcr.Project"
>>                extend="uk.ac.osswatch.simal.model.jcr.DoapResource"
>>                jcrType="nt:unstructured" jcrMixinTypes="mix:lockable" >
>>                <collection-descriptor
>>          fieldName="repositories" jcrName="rcs"
>>          elementClassName="uk.ac.osswatch.simal.model.jcr.Repository" />
>>        </class-descriptor>
>>
>>        <class-descriptor
>>                className="uk.ac.osswatch.simal.model.jcr.Repository"
>>                extend="uk.ac.osswatch.simal.model.jcr.DoapResource"
>>                jcrType="nt:unstructured" jcrMixinTypes="mix:lockable" >
>>        </class-descriptor>
>>
>> In the Project class I have:
>>
>>
>>        public Set<IDoapRepository> getRepositories() throws
>> SimalRepositoryException
>>
>> and
>>
>>        public void setRepositories(Set<IDoapRepository> repos) throws
>> SimalRepositoryException
>>
>> In my test code I create a test object and save it. When I retrieve
>> the Project object it comes back compete with the repository data.
>> However, when I try and retrieve all projects that have a none null
>> value for the repository data I get no results.
>>
>> The code I use for retrieving the projects with a repository  uses a
>> NotNull filter as follows:
>>
>>                Filter filter = queryManager.createFilter(Project.class);
>>                filter.addNotNull("rcs");
>>
>>                Query query = queryManager.createQuery(filter);
>>                Collection<IProject> projects =
>> (Collection<IProject>)ocm.getObjects(query);
>>                return new HashSet<IProject>(projects);
>>
>> Any idea what I'm doing wrong?
>>
>> Ross
>>
>> --
>> Ross Gardler
>>
>> OSS Watch - supporting open source in education and research
>> http://www.oss-watch.ac.uk
>>
>



-- 
Ross Gardler

OSS Watch - supporting open source in education and research
http://www.oss-watch.ac.uk

Mime
View raw message