Add insertable = false with updateable = false (#2027)
add insertable = false on same places where hibernate validatire requires the purpose is that code become more less eclipselink bound and to be closer to potentially hibernate supported Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -71,12 +71,16 @@ public class JpaAction extends AbstractJpaTenantAwareBaseEntity implements Actio
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||
@JoinColumn(name = "distribution_set", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_action_ds"))
|
||||
@JoinColumn(
|
||||
name = "distribution_set", nullable = false, updatable = false,
|
||||
foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_action_ds"))
|
||||
@NotNull
|
||||
private JpaDistributionSet distributionSet;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||
@JoinColumn(name = "target", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_targ_act_hist_targ"))
|
||||
@JoinColumn(
|
||||
name = "target", updatable = false,
|
||||
foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_targ_act_hist_targ"))
|
||||
@NotNull
|
||||
private JpaTarget target;
|
||||
|
||||
@@ -124,11 +128,15 @@ public class JpaAction extends AbstractJpaTenantAwareBaseEntity implements Actio
|
||||
private List<JpaActionStatus> actionStatus;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "rolloutgroup", updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_action_rolloutgroup"))
|
||||
@JoinColumn(
|
||||
name = "rolloutgroup", updatable = false,
|
||||
foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_action_rolloutgroup"))
|
||||
private JpaRolloutGroup rolloutGroup;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "rollout", updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_action_rollout"))
|
||||
@JoinColumn(
|
||||
name = "rollout", updatable = false,
|
||||
foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_action_rollout"))
|
||||
private JpaRollout rollout;
|
||||
|
||||
@Column(name = "maintenance_cron_schedule", updatable = false, length = Action.MAINTENANCE_WINDOW_SCHEDULE_LENGTH)
|
||||
|
||||
@@ -58,7 +58,9 @@ public class JpaActionStatus extends AbstractJpaTenantAwareBaseEntity implements
|
||||
private long occurredAt;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||
@JoinColumn(name = "action", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_act_stat_action"))
|
||||
@JoinColumn(
|
||||
name = "action", nullable = false, updatable = false,
|
||||
foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_act_stat_action"))
|
||||
@NotNull
|
||||
private JpaAction action;
|
||||
|
||||
@@ -82,9 +84,14 @@ public class JpaActionStatus extends AbstractJpaTenantAwareBaseEntity implements
|
||||
|
||||
@CascadeOnDelete
|
||||
@ElementCollection(fetch = FetchType.LAZY, targetClass = String.class)
|
||||
@CollectionTable(name = "sp_action_status_messages", joinColumns = @JoinColumn(name = "action_status_id", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_stat_msg_act_stat"), updatable = false, nullable = false), indexes = {
|
||||
@Index(name = "sp_idx_action_status_msgs_01", columnList = "action_status_id") })
|
||||
@Column(name = "detail_message", length = MESSAGE_ENTRY_LENGTH, nullable = false, updatable = false)
|
||||
@CollectionTable(
|
||||
name = "sp_action_status_messages",
|
||||
joinColumns = @JoinColumn(
|
||||
name = "action_status_id", insertable = false, updatable = false, nullable = false,
|
||||
foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_stat_msg_act_stat")),
|
||||
indexes = {
|
||||
@Index(name = "sp_idx_action_status_msgs_01", columnList = "action_status_id") })
|
||||
@Column(name = "detail_message", length = MESSAGE_ENTRY_LENGTH, nullable = false, insertable = false, updatable = false)
|
||||
private List<String> messages;
|
||||
|
||||
@Column(name = "code", nullable = true, updatable = false)
|
||||
|
||||
@@ -88,16 +88,30 @@ public class JpaDistributionSet extends AbstractJpaNamedVersionedEntity implemen
|
||||
|
||||
@CascadeOnDelete
|
||||
@ManyToMany(targetEntity = JpaSoftwareModule.class, fetch = FetchType.LAZY)
|
||||
@JoinTable(name = "sp_ds_module", joinColumns = {
|
||||
@JoinColumn(name = "ds_id", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_ds_module_ds")) }, inverseJoinColumns = {
|
||||
@JoinColumn(name = "module_id", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_ds_module_module")) })
|
||||
@JoinTable(
|
||||
name = "sp_ds_module",
|
||||
joinColumns = {
|
||||
@JoinColumn(
|
||||
name = "ds_id", nullable = false, insertable = false, updatable = false, foreignKey =
|
||||
@ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_ds_module_ds")) },
|
||||
inverseJoinColumns = {
|
||||
@JoinColumn(
|
||||
name = "module_id", nullable = false, insertable = false, updatable = false,
|
||||
foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_ds_module_module")) })
|
||||
private Set<SoftwareModule> modules;
|
||||
|
||||
@CascadeOnDelete
|
||||
@ManyToMany(targetEntity = JpaDistributionSetTag.class)
|
||||
@JoinTable(name = "sp_ds_dstag", joinColumns = {
|
||||
@JoinColumn(name = "ds", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_ds_dstag_ds")) }, inverseJoinColumns = {
|
||||
@JoinColumn(name = "TAG", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_ds_dstag_tag")) })
|
||||
@JoinTable(
|
||||
name = "sp_ds_dstag",
|
||||
joinColumns = {
|
||||
@JoinColumn(
|
||||
name = "ds", nullable = false, insertable = false, updatable = false,
|
||||
foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_ds_dstag_ds")) },
|
||||
inverseJoinColumns = {
|
||||
@JoinColumn(
|
||||
name = "TAG", nullable = false, insertable = false, updatable = false,
|
||||
foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_ds_dstag_tag")) })
|
||||
private Set<DistributionSetTag> tags;
|
||||
|
||||
@ToString.Exclude
|
||||
|
||||
@@ -159,9 +159,13 @@ public class JpaTarget extends AbstractJpaNamedEntity implements Target, EventAw
|
||||
@JoinTable(
|
||||
name = "sp_target_target_tag",
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "target", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_targ_targtag_target")) },
|
||||
@JoinColumn(
|
||||
name = "target", nullable = false, insertable = false, updatable = false,
|
||||
foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_targ_targtag_target")) },
|
||||
inverseJoinColumns = {
|
||||
@JoinColumn(name = "tag", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_targ_targtag_tag"))
|
||||
@JoinColumn(
|
||||
name = "tag", nullable = false, insertable = false, updatable = false,
|
||||
foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_targ_targtag_tag"))
|
||||
})
|
||||
private Set<TargetTag> tags;
|
||||
|
||||
@@ -174,8 +178,8 @@ public class JpaTarget extends AbstractJpaNamedEntity implements Target, EventAw
|
||||
@MapKeyColumn(name = "attribute_key", nullable = false, length = Target.CONTROLLER_ATTRIBUTE_KEY_SIZE)
|
||||
@CollectionTable(
|
||||
name = "sp_target_attributes",
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "target_id", nullable = false, updatable = false) }, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_targ_attrib_target"))
|
||||
joinColumns = { @JoinColumn(name = "target_id", nullable = false, insertable = false, updatable = false) },
|
||||
foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_targ_attrib_target"))
|
||||
private Map<String, String> controllerAttributes;
|
||||
|
||||
@CascadeOnDelete
|
||||
|
||||
@@ -53,9 +53,16 @@ public class JpaTargetType extends AbstractJpaTypeEntity implements TargetType,
|
||||
|
||||
@CascadeOnDelete
|
||||
@ManyToMany(targetEntity = JpaDistributionSetType.class)
|
||||
@JoinTable(name = "sp_target_type_ds_type_relation", joinColumns = {
|
||||
@JoinColumn(name = "target_type", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_target_type_relation_target_type")) }, inverseJoinColumns = {
|
||||
@JoinColumn(name = "distribution_set_type", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_target_type_relation_ds_type")) })
|
||||
@JoinTable(
|
||||
name = "sp_target_type_ds_type_relation",
|
||||
joinColumns = {
|
||||
@JoinColumn(
|
||||
name = "target_type", nullable = false, insertable = false, updatable = 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,
|
||||
foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_target_type_relation_ds_type")) })
|
||||
private Set<DistributionSetType> distributionSetTypes;
|
||||
|
||||
public JpaTargetType(final String key, final String name, final String description, final String colour) {
|
||||
|
||||
@@ -56,8 +56,8 @@ public class RolloutTargetGroup implements Serializable {
|
||||
|
||||
@OneToMany(targetEntity = JpaAction.class, fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST })
|
||||
@JoinColumns(value = {
|
||||
@JoinColumn(name = "rolloutgroup", nullable = false, updatable = false, referencedColumnName = "rolloutGroup_Id"),
|
||||
@JoinColumn(name = "target", nullable = false, updatable = false, referencedColumnName = "target_id") })
|
||||
@JoinColumn(name = "rolloutgroup", nullable = false, insertable = false, updatable = false, referencedColumnName = "rolloutGroup_Id"),
|
||||
@JoinColumn(name = "target", nullable = false, insertable = false, updatable = false, referencedColumnName = "target_id") })
|
||||
private List<JpaAction> actions;
|
||||
|
||||
/**
|
||||
|
||||
@@ -75,7 +75,7 @@ public interface DistributionSetRepository
|
||||
*/
|
||||
@Modifying
|
||||
@Transactional
|
||||
@Query("update JpaDistributionSet d set d.deleted = 1 where d.id in :ids")
|
||||
@Query("update JpaDistributionSet d set d.deleted = true where d.id in :ids")
|
||||
void deleteDistributionSet(@Param("ids") Long... ids);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user