Option 1, query against the Pixels set itself:
- Code: Select all
>>> iquery = sf.getQueryService()
>>> image = iquery.find('Image', 1L)
>>> pixels = iquery.findByQuery('from Pixels as p where p.image = %d' \
... % image.id.val, None)
>>> pixels.id
object #0 (::omero::RLong)
{
_val = 1
}
>>> pixels.id
object #0 (::omero::RLong)
{
_val = 1
}
Option 2, query with a fetch:
- Code: Select all
>>> image = iquery.findByQuery('from Image as image join fetch image.pixels '
... 'where image.id = %d' % 1L, None)
>>> image.id
object #0 (::omero::RLong)
{
_val = 1
}
>>> image.getPrimaryPixels().id.val
1L
These are HQL queries, which is an object oriented query language included as part of Hibernate. You can read more about HQL here:
http://docs.jboss.org/hibernate/stable/ ... ryhql.html