[ome-devel] load object graph
Bernhard Voigt
bernhard.voigt at gmail.com
Thu Nov 27 13:12:24 GMT 2008
Hi Jean-Marie,
from your query I see the problem was the "(inner) join" in my query.
It does not return objects with null references. You're performing
"outer joins" and that works well with incomplete object graphs.
Thanks a bunch! Bernhard
On Thu, Nov 27, 2008 at 1:12 PM, jean-marie <j.burel at dundee.ac.uk> wrote:
> Hi Bernhard
> That's the call I do to retrieve the wells within a plate.
>
> Set loadPlateWells(long plateID, long userID)
> throws DSOutOfServiceException, DSAccessException
> {
> isSessionAlive();
> try {
> List results = null;
> IQueryPrx service = getQueryService();
> StringBuilder sb = new StringBuilder();
> ParametersI param = new ParametersI();
> param.addLong("plateID", plateID);
>
> sb.append("select well from Well as well ");
> sb.append("left outer join fetch well.wellSamples as ws ");
> sb.append("left outer join fetch ws.image as img ");
>
> sb.append("left outer join fetch img.pixels as pix ");
> sb.append("left outer join fetch pix.pixelsType as pt ");
>
> sb.append("where well.plate.id = :plateID");
> results = service.findAllByQuery(sb.toString(), param);
> Iterator i;
> Well well;
> Set<DataObject> wells = new HashSet<DataObject>();
> i = results.iterator();
> WellData wellData;
> List<WellSampleData> list;
> Map<Long, List<WellSampleData>>
> map = new HashMap<Long, List<WellSampleData>>();
> Iterator<WellSample> j;
> WellSample ws;
>
> while (i.hasNext()) {
> well = (Well) i.next();
> wellData = (WellData) PojoMapper.asDataObject(well);
> wells.add(wellData);
> }
>
> return wells;
> } catch (Exception e) {
> handleException(e, "Cannot load plate");
> }
> return new HashSet();
>
> The OMERO.insight manipulates DataObject (pojos.DataObject)
> So you can ignore that part.
> Let me know if you have any questions.
> The logic of this call is currently sitting in OMERO.insight, It will be
> moved
> to one of the services provided later.
> Ciao
> jmarie
>
>
>
>
>
More information about the ome-devel
mailing list