[ome-devel] Querying Annotations

Bernhard Voigt bernhard.voigt at gmail.com
Thu Mar 5 15:37:16 GMT 2009


Hi Matthias!

just use the the *AnnotationLink table, Hibernate does the joining
automagically:

select l.child from DatasetAnnotationLink l
where l.parent = 1

Cheers! Bernhard

On Thu, Mar 5, 2009 at 4:23 PM, Matthias Dunda
<Matthias.Dunda at carus-it.com> wrote:
> Hi,
>
> I want to find all annotations to a Dataset. I added CommentAnnotations before and am now willing to read them out again...
>
> First shot:
>
> findAllByQuery("select a from Annotation a " +
>                        "join DatasetAnnotationLink as dal " +
>                        "where dal.parent = 1 ", null);
>
> for dataset-ID = 1.
>
> This gives me:
>
> Exception in thread "main" omero.ApiUsageException
>    serverStackTrace = "ome.conditions.ApiUsageException: Path expected for join! [select a from ome.model.annotations.Annotation a join DatasetAnnotationLink as dal where dal.parent = 1 ]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: Path expected for join! [select a from ome.model.annotations.Annotation a join DatasetAnnotationLink as dal where dal.parent = 1 ]
>                                at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:642)
>                                at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
>                                at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424)
>                                .......
>
> What's the right way?
>
> Thanks
> Matthias
>
> _______________________________________________
> ome-devel mailing list
> ome-devel at lists.openmicroscopy.org.uk
> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel
>


More information about the ome-devel mailing list