anchor.diff:    @javax.inject.Inject
     private <%= repository.service_by_name(repository.imit.session_context_service).ejb.qualified_service_name %> _context;
   <% end -%>
  -
  +<%
  +  entities_requiring_repositories = []
  +  repository.imit.graphs.select{|graph| graph.instance_root? }.each do |graph|
  +    graph.reachable_entities.collect{|n|repository.entity_by_name(n)}.select { |entity| entity.imit? && entity.concrete? }.each do |entity|
  +      entity.
  +         referencing_attributes.
  +         select{|a| a.imit? && a.inverse.imit.traversable? && a.inverse.imit.replication_edges.include?(graph.name) && !a.imit.graph_links.any?{|g| g.source_graph == graph && !g.exclude_target? }}.
  +         select{|a| !a.inverse.jpa.java_traversable?}.
  +         each {|a| entities_requiring_repositories << a.entity }
  +    end
  +  end
  +  entities_requiring_repositories = entities_requiring_repositories.sort_by{|e|e.qualified_name}.uniq
  +  -%>
  +<% entities_requiring_repositories.each do |entity| -%>
  +  @javax.inject.Inject
  +  private <%= entity.dao.jpa.qualified_dao_service_name %> _<%= Reality::Naming.camelize(entity.data_module.name) %><%= entity.name %>Repository;
  +<% end -%>
   <%
     repository.imit.graphs.select{|graph| graph.instance_root? }.each do |graph|
       entity = repository.entity_by_name(graph.instance_root)
  
positive.code:     outgoing_links.each do |a|
        if a.inverse.multiplicity == :many
  -%>
      for ( final <%= a.entity.jpa.qualified_name %> o : <% if graph.filtered? %>_context.get<%= a.inverse.attribute.qualified_name.gsub('.','') %>In<%= graph.name %>Graph( object<% if graph.filter_parameter? %>, filter<% end %> )<% else %>object.get<%= Reality::Naming.pascal_case(Reality::Naming.pluralize(a.inverse.name)) %>()<% end %> )
      {
        if( !messages.containsEntityMessage( <%= repository.imit.qualified_entity_type_constants_name %>.<%= Reality::Naming.uppercase_constantize(a.entity.data_module.name.to_s) %>_<%= Reality::Naming.uppercase_constantize(a.entity.name.to_s) %>, o.get<%= a.referenced_entity.primary_key.name %>() ) )
        {
  
negative.code:       elsif a.inverse.multiplicity == :one || a.inverse.multiplicity == :zero_or_one
  -%>
      {
        final <%= a.entity.jpa.qualified_name %> o = <% if filter_param %>_context.get<%= a.inverse.name %>In<%= graph.name %>Graph( object, filter )<% elsif !a.inverse.jpa.java_traversable? %>_<%= Reality::Naming.camelize(a.entity.data_module.name) %><%= a.entity.name %>Repository.<%= a.inverse.multiplicity == :zero_or_one ? 'find' : 'get' %>By<%= a.name %>( object )<% else %>object.get<%= a.inverse.name %>()<% end %>;
        <% if a.inverse.multiplicity == :zero_or_one %>if( null != o )<% end %>
        {
          if( !messages.containsEntityMessage( <%= repository.imit.qualified_entity_type_constants_name %>.<%= Reality::Naming.uppercase_constantize(a.entity.data_module.name.to_s) %>_<%= Reality::Naming.uppercase_constantize(a.entity.name.to_s) %>, o.get<%= a.referenced_entity.primary_key.name %>() ) )
  