[ome-devel] Plates and Wells
josh.moore at gmx.de
josh.moore at gmx.de
Thu Nov 20 19:46:14 GMT 2008
Bernhard Voigt writes:
> Hi Josh and others!
Hi Bernhard.
> I'm over the first obstacle, so I've changed the topic ;-)
Good idea. Thanks.
> > Hmm...could you show me more of what you are trying? There are
> > certainly complications when dealing with the security details
> > ("plate.details") but you don't seem to be doing that. For reference,
> > I just ran the following against a Beta3.1 blitz:
> >
> > import sys
> > sys.path.append("dist/lib")
> >H
> > import omero
> > c = omero.client(["--Ice.Config=dist/etc/ice.config"])
> > s = c.createSession("root","xxx")
> >
> > p = omero.model.PlateI()
> > p.name = omero.RString("plate")
> > p = s.getUpdateService().saveAndReturnObject(p)
> >
> > w = omero.model.WellI()
> > w.name = omero.RString("well")
> > w.setPlate(p)
> > w = s.getUpdateService().saveAndReturnObject(w)
> >
> > print w
>
> Yes, one well works well. Adding more to one plate yields the
> security error. The code I'm using is attached, if you've run in with
> python -i simpleblitz.py $user $password
> than do
> >>> p,ws=pc.createPlate('plate 10', 1, 1)
> which works fine, if you change the number of rows, or columns I get
> the error message
> >>> p,ws=pc.createPlate('plate 11', 1, 2)
> ... error...
>
> Another problem, using the example that creates only one well:
> If I do ws.getPlate() I get the plate. If I, however, do p.getWells()
> I get an empty list. I tried p = omero.model.PlateI(p.getId(), True)
> but this doesn't yield a well list either.
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 )
> 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