Skip to content

Merging a bidirectional list creates unnecessary UPDATE statement #1530

Open
@RogerKratz

Description

@RogerKratz

Having following mapping...

<class name="Parent">
	<id name="Id" type="guid">
	  <generator class="guid.comb" />
	</id>
	<list name="Children" cascade="all-delete-orphan" inverse="true">
		<key column="Parent" not-null="true"/>
		<list-index column="OrderIndex"  />
		<one-to-many class="Child"/>
	</list>
	<property name="Name" />
</class>

<class name="Child">
	<id name="Id" type="guid">
	  <generator class="guid.comb" />
	</id>
	<many-to-one name="Parent" class="Parent" />
	<property name="OrderIndex" access="readonly"/>
	<property name="Name" />	
 </class>

...will cause INSERT + UPDATE when adding a new child and doing session.Merge(parent).

Will add a PR soon.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions