Skip to content

Commit

Permalink
Fix @manytomany to be hibernate compatible (#2116)
Browse files Browse the repository at this point in the history
Signed-off-by: Avgustin Marinov <[email protected]>
  • Loading branch information
avgustinmm authored Dec 3, 2024
1 parent 74616db commit 58e427d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<>();

Expand All @@ -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<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<>();

Expand Down

0 comments on commit 58e427d

Please sign in to comment.