anchor.diff:    @java.lang.Override
     public boolean createOrUpdate<%= entity.data_module.name %><%= entity.name %>( @javax.annotation.Nonnull final String mappingSourceCode, @javax.annotation.Nonnull final java.lang.Object[] record )
     {
  -<% attr = entity.attributes.select{|a| a.jpa? && (a.sync? || %w(CreatedAt MasterId).include?(a.name.to_s)) } -%>
  +<% attr = entity.sync.master_entity.attributes.select{|a| a.name != :DeletedAt && (a.primary_key? || entity.attribute_by_name?(a.name)) }.collect{|a| a.primary_key? ? entity.primary_key : entity.attribute_by_name(a.name)} + [entity.attribute_by_name(:MasterId)] -%>
   <% attr.each_with_index do |a, i| -%>
   <% if a.enumeration? && a.enumeration.textual_values? -%>
       final <%= a.jpa.java_type(:boundary) %> v_<%= a.name %> = <%= a.nullable? ? "null == record[ #{i} ] ? null : " : ''  %><%= a.jpa.java_type(:boundary) %>.valueOf( (java.lang.String) record[ <%= i %> ] );
  
positive.code:   {
  <% bulk_attrs = entity.attributes.select{|a| a.sql? && a.jpa? && (a.sync? || %w(CreatedAt).include?(a.name.to_s)) }
     bulk_attrs_insert = j_escape_string(bulk_attrs.collect{|a| a.primary_key? ? entity.sql.dialect.quote(:MasterId) : a.sql.quoted_column_name}.join(', '))
     bulk_attrs_select = j_escape_string(bulk_attrs.collect{|a| a.primary_key? ? entity.sync.master_entity.primary_key.sql.quoted_column_name : entity.sync.master_entity.attribute_by_name(a.name.to_s).sql.quoted_column_name}.join(', '))
    -%>
      return
        "INSERT INTO <%= j_escape_string( entity.sql.qualified_table_name ) %>\n" +
        " ( <%= bulk_attrs_insert -%> )\n " +
        "SELECT <%= bulk_attrs_select %> FROM ( " +
        getSqlToRetrieve<%= fn %>ListToUpdate( mappingSourceCode ) + " AND \n" +
        "<%= j_escape_string("#{entity.sync.master_entity.attribute_by_name(entity.root_entity.name).sql.quoted_column_name} IS NULL") -%>) X\n";
    }
  
negative.code:         index = -1
          "COALESCE(#{a.referenced_entity.concrete_subtypes.collect do |subtype| "R#{ref_index}#{index += 1}.#{subtype.attribute_by_name(subtype.root_entity.name).sql.quoted_column_name}" end.join(', ')})"
        else
          "R#{ref_index}.#{a.referenced_entity.attribute_by_name(a.referenced_entity.root_entity.name).sql.quoted_column_name} AS #{entity.attribute_by_name(a.name).sql.quoted_column_name}"
        end
      else
        "M.#{a.sql.quoted_column_name}"
      end
    end + ["M.#{entity.sync.master_entity.attribute_by_name(:Id).sql.quoted_column_name} AS #{entity.sql.dialect.quote(:MasterId)}",
           "M.#{entity.sync.master_entity.attribute_by_name(:MappingId).sql.quoted_column_name}"]).join(', ')
  
    joins = ''
  