[ome-devel] Plates and Wells

Bernhard Voigt bernhard.voigt at gmail.com
Fri Nov 21 12:50:43 GMT 2008


Hi Josh!

> Aha. I understand. So, there's a general issue here to go over and
> there's a pretty straight-forward workaround. When an object gets
> returned from saveAndReturnObject() it's obj.details.updateEvent has
> been incremented, as a form of optimistic lock. It makes two objects
> whose ids are equals:
>
>  obj_old.id.val == obj_new.id.val
>
> still somewhat different. For example, if you change the name on a
> plate and the old plate instance is hanging around somewhere and you
> pass it back to the server, the incremented update event prevents you
> from undoing your name change. This is because Hibernate implements
> transitive persistence and examines the entire graph of objects that
> you pass over the wire and saves whatever needs to be saved.
>
> The most straight-forward way to fix your problem, then, is to use
> this to your advantage. Build a larger graph plate-->well, well, well,
> and then send all of it to the server at once.
>
> Eventually, though, you will want to create so many objects that it's
> not practical to do it all in one go, and at that point "unloaded"
> objects are what you need. They act as placeholders for the real
> objects, or proxies, but carry no data. To create one use the object
> constructor:
>
>        plate = PlateI( old_plate.id, False )

Ah yes, I understand. The approach with the creation of the complete
graph worked out. Though, there are still questions remaining and new
occuring ;-)

First, is it always necessary to create the links between objects from
both ends?
        # create list of well objects
        wells = self.createWells(cols, rows)
        # link plate to wells
        map(lambda w: w.setPlate(plate), wells)
        plate.setWells(wells)
        plate = self.update.saveAndReturnObject(plate)

I had to set the well's plate, otherwise there was an exception of a
Null ref object (the plate). If I'd left out the plate.setWells call,
the wells wouldn't be stored.

Second, how to get the wells of an not fully loaded plate object:
plate = omero.model.PlateI(someId) # or a query without a join to wells
plate.getWellLinks() # does not exist

Well, my guess is that it's probably better to use the Pojos service
at this point, but I'm stuck again:
pojos = session.getPojosService()
pojos.loadContainerHierarchy(omero.model.Plate, [plate.etId().val], None)
>>> ValueError: invalid value for argument 1 in operation `loadContainerHierarchy'

Thanks again! I appreciate your help! Bernhard




>
>  > Thanks again for you help! Bernhard
>
> As always, gladly.
> Cheers,
> ~Josh.
>
> P.S. Note some of these examples will be slightly different in Beta4.
>


More information about the ome-devel mailing list