Fix CascadeType.REMOVE on ManyToMany (#2029)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-11-15 11:59:37 +02:00
committed by GitHub
parent a2f03b3724
commit 2d0c0a5989
3 changed files with 4 additions and 4 deletions

View File

@@ -86,7 +86,7 @@ public class JpaDistributionSet extends AbstractJpaNamedVersionedEntity implemen
@NotNull @NotNull
private DistributionSetType type; private DistributionSetType type;
@ManyToMany(targetEntity = JpaSoftwareModule.class, fetch = FetchType.LAZY, cascade = { CascadeType.REMOVE }) @ManyToMany(targetEntity = JpaSoftwareModule.class, fetch = FetchType.LAZY)
@JoinTable( @JoinTable(
name = "sp_ds_module", name = "sp_ds_module",
joinColumns = { joinColumns = {
@@ -99,7 +99,7 @@ public class JpaDistributionSet extends AbstractJpaNamedVersionedEntity implemen
foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_ds_module_module")) }) foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_ds_module_module")) })
private Set<SoftwareModule> modules; private Set<SoftwareModule> modules;
@ManyToMany(cascade = { CascadeType.REMOVE }, targetEntity = JpaDistributionSetTag.class) @ManyToMany(targetEntity = JpaDistributionSetTag.class)
@JoinTable( @JoinTable(
name = "sp_ds_dstag", name = "sp_ds_dstag",
joinColumns = { joinColumns = {

View File

@@ -105,7 +105,7 @@ public class JpaSoftwareModule extends AbstractJpaNamedVersionedEntity implement
@ToString.Exclude @ToString.Exclude
@Getter(AccessLevel.NONE) @Getter(AccessLevel.NONE)
@ManyToMany(mappedBy = "modules", targetEntity = JpaDistributionSet.class, fetch = FetchType.LAZY, cascade = { CascadeType.REMOVE }) @ManyToMany(mappedBy = "modules", targetEntity = JpaDistributionSet.class, fetch = FetchType.LAZY)
private List<DistributionSet> assignedTo; private List<DistributionSet> assignedTo;
/** /**

View File

@@ -151,7 +151,7 @@ public class JpaTarget extends AbstractJpaNamedEntity implements Target, EventAw
@JoinColumn(name = "target_type", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_target_relation_target_type")) @JoinColumn(name = "target_type", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_target_relation_target_type"))
private TargetType targetType; private TargetType targetType;
@ManyToMany(cascade = { CascadeType.REMOVE }, targetEntity = JpaTargetTag.class) @ManyToMany(targetEntity = JpaTargetTag.class)
@JoinTable( @JoinTable(
name = "sp_target_target_tag", name = "sp_target_target_tag",
joinColumns = { joinColumns = {