> > > 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
of course (even if it is working) you are welcome to send us a patch for adding a new unit test for this method. Thanks > > > > > > 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 > >> > > > > > > -- > Ross Gardler > > OSS Watch - supporting open source in education and research > http://www.oss-watch.ac.uk >
