Remvoe use of @ExistenceChecking (#2034)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.jpa.model;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@@ -25,33 +26,33 @@ import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.OneToMany;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.persistence.annotations.ExistenceChecking;
|
||||
import org.eclipse.persistence.annotations.ExistenceType;
|
||||
|
||||
/**
|
||||
* Entity with JPA annotation to store the information which {@link Target} is
|
||||
* in a specific {@link RolloutGroup}.
|
||||
* Entity with JPA annotation to store the information which {@link Target} is in a specific {@link RolloutGroup}.
|
||||
*/
|
||||
@NoArgsConstructor(access = AccessLevel.PUBLIC) // JPA constructor
|
||||
@IdClass(RolloutTargetGroupId.class)
|
||||
@Entity
|
||||
@Table(name = "sp_rollouttargetgroup")
|
||||
@ExistenceChecking(ExistenceType.ASSUME_NON_EXISTENCE)
|
||||
public class RolloutTargetGroup implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@ManyToOne(optional = false, targetEntity = JpaRolloutGroup.class, fetch = FetchType.LAZY, cascade = {
|
||||
CascadeType.PERSIST })
|
||||
@ManyToOne(optional = false, targetEntity = JpaRolloutGroup.class, fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST })
|
||||
@JoinColumn(name = "rolloutGroup_Id", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_rollouttargetgroup_group"))
|
||||
private JpaRolloutGroup rolloutGroup;
|
||||
|
||||
@Id
|
||||
@ManyToOne(optional = false, targetEntity = JpaTarget.class, fetch = FetchType.LAZY, cascade = {
|
||||
CascadeType.PERSIST })
|
||||
@JoinColumn(name = "target_id", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_rollouttargetgroup_target"))
|
||||
@ManyToOne(optional = false, targetEntity = JpaTarget.class, fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST })
|
||||
@JoinColumn(
|
||||
name = "target_id", nullable = false, updatable = false,
|
||||
foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_rollouttargetgroup_target"))
|
||||
private JpaTarget target;
|
||||
|
||||
@OneToMany(targetEntity = JpaAction.class, fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST })
|
||||
@@ -60,13 +61,6 @@ public class RolloutTargetGroup implements Serializable {
|
||||
@JoinColumn(name = "target", nullable = false, insertable = false, updatable = false, referencedColumnName = "target_id") })
|
||||
private List<JpaAction> actions;
|
||||
|
||||
/**
|
||||
* default constructor for JPA.
|
||||
*/
|
||||
public RolloutTargetGroup() {
|
||||
// JPA constructor
|
||||
}
|
||||
|
||||
public RolloutTargetGroup(final RolloutGroup rolloutGroup, final Target target) {
|
||||
this.rolloutGroup = (JpaRolloutGroup) rolloutGroup;
|
||||
this.target = (JpaTarget) target;
|
||||
@@ -75,4 +69,4 @@ public class RolloutTargetGroup implements Serializable {
|
||||
public RolloutTargetGroupId getId() {
|
||||
return new RolloutTargetGroupId(rolloutGroup, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,8 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* {@link SoftwareModule} repository.
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public interface SoftwareModuleRepository
|
||||
extends BaseEntityRepository<JpaSoftwareModule> {
|
||||
public interface SoftwareModuleRepository extends BaseEntityRepository<JpaSoftwareModule> {
|
||||
|
||||
/**
|
||||
* Counts all {@link SoftwareModule}s based on the given {@link JpaSoftwareModuleType}.
|
||||
|
||||
Reference in New Issue
Block a user