def query_object(obj, attribute=nil)
      if hook_proxy_attribute?(obj, attribute) then
        query_hook_proxies(obj, attribute)
      elsif CaTissue::SpecimenRequirement === obj and not obj.identifier and obj.collection_protocol_event then
        query_requirement_using_cpe_inversion(obj, attribute)
      elsif CaTissue::ContainerPosition === obj and obj.identifier and attribute == :occupied_container then
        query_container_position_occupied_container(obj, attribute)
      else
        super
      end
    end
def query_object(obj, attribute=nil)
      if hook_proxy_attribute?(obj, attribute) then
        query_hook_proxies(obj, attribute)
      elsif CaTissue::SpecimenRequirement === obj and not obj.identifier and obj.collection_protocol_event then
        query_requirement_using_cpe_inversion(obj, attribute)
      elsif CaTissue::ContainerPosition === obj and obj.identifier and attribute == :occupied_container then
        query_container_position_occupied_container(obj, attribute)
      else
        super
      end
    end
@quirk caTissue Bug #147: SpecimenRequirement query ignores CPE.
   Work around this bug by an inverted query on the referenced CPE.

 @quirk caTissue Accessing an annotation hook DE proxy attribute uses a separate mechanism.
   Redirect the query to the annotation integration service in that case.

 @quirk caTissue Bug #169: ContainerPosition occupied container query returns parent
   container instead. Substitute a hard-coded HQL search for this case.

 @see CaRuby::Database#query_object