Make session.merge respect entity_name

Issue #540 resolved
Former user created an issue

As discussed on IRC, this patch makes session.merge respect entity_name.

Comments (2)

  1. Mike Bayer repo owner

    OK, not exactly, the correct patch is in changeset:2505. this propigates entity_name for transient instances only, meaning if the given object is already session.save()d, it will use the entity_name thats already on the instance.

    so to save a new instance to two mappers, dont use session.save() at all. use:

      instance = MyObject(<values>)
      session.merge(instance, entity_name=None)
      session.merge(instance, entity_name='foo')
      session.merge(instance, entity_name='bar')
      session.flush()
    
  2. Log in to comment