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.
2009/7/14 Ross Gardler <[email protected]> > 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 >
