select rel_id from acs_rels where rel_type = :rel_type and ( object_id_one = :object_id_one and object_id_two = :object_id_two ) select rel_id from acs_rels where rel_type = :rel_type and object_id_one = :object_id_one and object_id_two = :object_id_two select acs_rel__new ( :rel_id, :rel_type, :object_id_one, :object_id_two, :context_id, :creation_user, :creation_ip ) insert into contact_rels (rel_id) values (:rel_id)