[ome-devel] Hibernate PropertyAccessExcpetion when creating WellSamples in 4.0.1
josh.moore at gmx.de
josh.moore at gmx.de
Mon Apr 27 17:08:34 BST 2009
Bernhard Holländer writes:
> > On import, each well sample is added to the well in the same order. So
> > wellA.getSample(1) and wellB.getSample(1) will return related
> > fields. Note: in the 4.1 database (currently trunk), there is a new
> > field "Plate.defaultSample" which can be used to store the users
> > choice of the current Well.wellSample index. This will be released
> > before the meeting in Paris (May 19-20).
> Great, thanks for the info.
Sure.
> > > I try if it's possible to load the existing well, add a well sample
> > > and save the modified well to insert the new sample. If you see a
> > > problem in this approach, please let me know.
> >
> > This should work. You'll have to be careful about keeping your objects
> > loaded and up-to-date, but that's standard fare.
>
> This approach seems to work, but I still have questions:
>
> I select the well and its well samples like this:
>
> select w from Well w
> left outer join fetch w.wellSamples
>
> Do I have to load other relations in order not to delete them when I
> save the well later?
No. Any collection that isn't fetched will be nulled out.
> Here's the modified code to add well samples to existing wells:
>
> ws = WellSampleI()
> ws.well = WellI(w.id, False) # w comes from the query above
> ws.image = ImageI(image.id, False)
> w.addWellSample(ws)
> w = self.updates.saveAndReturnObject(w)
> ws = w.getWellSample(w.sizeOfWellSamples()-1)
> ws = WellSampleI(ws.id.val, False)
> # now link ws to a screen acquistion
> >From your previous post I assume the last sample in the list of well
> samples is the newest added?
Not necessarily. This is file format specific, so if you know that the
format you're working with behaves this way then it's a fine
assumption. Unfortunately, we can't guarantee it for all formats.
> As always, thanks for your help! Bernhard
Gladly,
~Josh.
More information about the ome-devel
mailing list