Skip to content

Nested unmapped delete doesn't trigger remove listeners #2066

@beikov

Description

@beikov

An entity model with e.g.

@Entity
public class Document {
  @Id
  Integer id;
  @OneToMany(mappedBy = "revision", cascade = REMOVE)
  Set<DocumentRevision> revisions;
}
@Entity
public class DocumentRevision {
  @Id
  Integer id;
  @ManyToOne(fetch = LAZY)
  Document document;
  @ManyToOne(fetch = LAZY, cascade = REMOVE)
  DocumentFile file;
}
@Entity
public class DocumentFile {
  @Id
  Integer id;
  //...
}

Removing with evm.remove(em, DocumentIdView.class, 1) where

@Entity
public interface DocumentIdView {
  @IdMapping
  Integer getId();
}

A listener for the DocumentFile is not triggered.

It looks like maybe UnmappedBasicAttributeCascadeDeleter#removeWithoutPreCascadeDelete doesn't trigger remove listeners.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions