[ome-devel] Exception for getDefaultGroup

josh.moore at gmx.de josh.moore at gmx.de
Mon Sep 29 15:46:22 BST 2008


Matthias Dunda writes:
 > Hi guys,

Hi Matthias.

 > I have the collection of pojos.ProjectData from the Treeview in
 > Insight, which I want to process in some way.
 > 
 > When I do
 > 
 > for (pojos.ProjectData project : selectedProjects) {
 >         long projectId = project.getId();
 >         long userId = project.getOwner().getId();
 >         pojos.GroupData = project.getOwner().getDefaultGroup();
 >       /* more code... */
 > }
 > 
 > I get this exception:
 > 
 > java.lang.Exception: Abnormal termination due to an uncaught exception.
 > java.lang.IllegalStateException: Object unloaded:Experimenter:Id_1
 >         at ome.model.meta.Experimenter.errorIfUnloaded(Experimenter.java:857)
 >         at ome.model.meta.Experimenter.preGetter(Experimenter.java:69)
 >         at ome.model.meta.Experimenter.getDefaultGroupLink(Experimenter.java:613)
 >         at pojos.ExperimenterData.getDefaultGroup(ExperimenterData.java:223)
 >       ...
 > 
 > What's the reason for that?

I can't say why this happens in your usage in the Treeview, but
errorIfUnloaded() throws an exception when you access any field (other
than its id) on an object which was unloaded. Objects get unloaded,
either

 * by the server when a query does not explicitly "join fetch" them,

 * by a call to IObject.unload() 

 * by the constructor "new Experimenter(id, false)"

It's possible to test for loadedness via "IObject.isLoaded()", and if
necessary, to make another service call to load the object. For more
background information, see:

https://trac.openmicroscopy.org.uk/omero/wiki/ObjectModel#Entitylifecycle

~Josh.


More information about the ome-devel mailing list