Fix @ManyToMany to be hibernate compatible (#2116)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-12-03 14:21:01 +02:00
committed by GitHub
parent 74616db431
commit 58e427d1ea
3 changed files with 9 additions and 11 deletions

View File

@@ -85,18 +85,16 @@ public class JpaDistributionSet extends AbstractJpaNamedVersionedEntity implemen
@NotNull
private DistributionSetType type;
@ManyToMany(
targetEntity = JpaSoftwareModule.class, fetch = FetchType.LAZY,
cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@ManyToMany(targetEntity = JpaSoftwareModule.class, fetch = FetchType.LAZY)
@JoinTable(
name = "sp_ds_module",
joinColumns = {
@JoinColumn(
name = "ds_id", nullable = false, insertable = false, updatable = false,
name = "ds_id", nullable = false,
foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_ds_module_ds")) },
inverseJoinColumns = {
@JoinColumn(
name = "module_id", nullable = false, insertable = false, updatable = false,
name = "module_id", nullable = false,
foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_ds_module_module")) })
private Set<SoftwareModule> modules = new HashSet<>();
@@ -105,11 +103,11 @@ public class JpaDistributionSet extends AbstractJpaNamedVersionedEntity implemen
name = "sp_ds_dstag",
joinColumns = {
@JoinColumn(
name = "ds", nullable = false, insertable = false, updatable = false,
name = "ds", nullable = false,
foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_ds_dstag_ds")) },
inverseJoinColumns = {
@JoinColumn(
name = "TAG", nullable = false, insertable = false, updatable = false,
name = "TAG", nullable = false,
foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_ds_dstag_tag")) })
private Set<DistributionSetTag> tags = new HashSet<>();

View File

@@ -162,11 +162,11 @@ public class JpaTarget extends AbstractJpaNamedEntity implements Target, EventAw
name = "sp_target_target_tag",
joinColumns = {
@JoinColumn(
name = "target", nullable = false, insertable = false, updatable = false,
name = "target", nullable = false,
foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_targ_targtag_target")) },
inverseJoinColumns = {
@JoinColumn(
name = "tag", nullable = false, insertable = false, updatable = false,
name = "tag", nullable = false,
foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_targ_targtag_tag"))
})
private Set<TargetTag> tags;

View File

@@ -54,11 +54,11 @@ public class JpaTargetType extends AbstractJpaTypeEntity implements TargetType,
name = "sp_target_type_ds_type_relation",
joinColumns = {
@JoinColumn(
name = "target_type", nullable = false, insertable = false, updatable = false,
name = "target_type", nullable = false,
foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_target_type_relation_target_type")) },
inverseJoinColumns = {
@JoinColumn(
name = "distribution_set_type", nullable = false, insertable = false, updatable = false,
name = "distribution_set_type", nullable = false,
foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_target_type_relation_ds_type")) })
private Set<DistributionSetType> distributionSetTypes = new HashSet<>();