Problem on update COMPOSITION data collection table by getMutableItems()

I use a lookupField to add record in a COMPOSITION data collection. For remove record I used a generated column. I got 2 problem in below code.

  1. After “Save”, all removed COMPOSITION table record still exists.
    In Edit mode without any problem on adding record, but the removed record after save edit again all come back.

  2. Cannot save the added record in Create mode.
    When added record in COMPOSITION table on a NEW issue, the following error display.

	<instance id="issueDc" class="">
		<view extends="_local">
			<property name="issueScheme" view="_minimal"/>
		<collection id="issueSchemeDc" property="issueScheme"/>


	<lookupField id="dummyList" caption="Project Scheme" optionsContainer="projectSchemeDc"/>
	<groupTable id="issueSchemeTable" dataContainer="issueSchemeDc" width="100%" height="120"
				stylename="no-header borderless no-vertical-lines no-horizontal-lines no-stripes small">
			<column id="projectSchemeCode"/>
    public void onInit(InitEvent event) {        
        issueSchemeTable.addGeneratedColumn("Remove",1, entity -> {
            LinkButton field = uiComponents.create(LinkButton.class);
            field.setAction(new BaseAction("viewDescDetail")
                    .withCaption("View Description Detail")
                    .withHandler(clickEvent -> {
            return field;

    public void onDummyListValueChange(HasValue.ValueChangeEvent<ProjectScheme> event) {
        if (event.isUserOriginated()) {
            issueScheme newIssueScheme = metadata.create(issueScheme.class);


For discussion about removal see this topic.

For discussion about creation see this topic.

Thanks Maxim,

The removal problem was solved.

Also no problem on edit mode, but when I create new record another SQL error occur.
“SQLServerException: The INSERT statement conflicted with the FOREIGN KEY constraint”

I’m using SQL server as database, all table use have a Int Identity column.
I found that when I create new record, the system not using the same identity number of getEditedEntity() one to save the new record, so the foreign key error occour.

Any Idea on this error?