Skip to content

Commit

Permalink
MID-7173: fix of Hibernate expected column name for "autoScalingMode"
Browse files Browse the repository at this point in the history
  • Loading branch information
virgo47 committed Aug 24, 2021
1 parent a344684 commit 9311163
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ public RTaskSchedulingState getSchedulingState() {
}

@Embedded
@AttributeOverrides({
@AttributeOverride(name = "mode", column = @Column(name = "autoScalingMode"))
})
public RTaskAutoScaling getAutoScaling() {
return autoScaling;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.repo.sql.data.common.enums.RTaskAutoScalingMode;
import com.evolveum.midpoint.repo.sql.query.definition.JaxbName;
import com.evolveum.midpoint.repo.sql.query.definition.JaxbType;
import com.evolveum.midpoint.repo.sql.util.DtoTranslationException;
import com.evolveum.midpoint.repo.sql.util.RUtil;
Expand All @@ -24,32 +23,31 @@
@JaxbType(type = TaskAutoScalingType.class)
public class RTaskAutoScaling {

private RTaskAutoScalingMode autoScalingMode; // the name of the column in m_task
private RTaskAutoScalingMode mode;

@JaxbName(localPart = "mode")
public RTaskAutoScalingMode getAutoScalingMode() {
return autoScalingMode;
public RTaskAutoScalingMode getMode() {
return mode;
}

public void setAutoScalingMode(RTaskAutoScalingMode autoScalingMode) {
this.autoScalingMode = autoScalingMode;
public void setMode(RTaskAutoScalingMode mode) {
this.mode = mode;
}

public static void fromJaxb(TaskAutoScalingType jaxb, RTaskAutoScaling repo)
throws DtoTranslationException {
Objects.requireNonNull(jaxb, "JAXB object must not be null.");
Objects.requireNonNull(repo, "Repo object must not be null.");

repo.setAutoScalingMode(RUtil.getRepoEnumValue(jaxb.getMode(), RTaskAutoScalingMode.class));
repo.setMode(RUtil.getRepoEnumValue(jaxb.getMode(), RTaskAutoScalingMode.class));
}

public static void copyToJAXB(RTaskAutoScaling repo, TaskAutoScalingType jaxb,
@SuppressWarnings("unused") PrismContext prismContext) {
Objects.requireNonNull(jaxb, "JAXB object must not be null.");
Objects.requireNonNull(repo, "Repo object must not be null.");

if (repo.getAutoScalingMode() != null) {
jaxb.setMode(repo.getAutoScalingMode().getSchemaValue());
if (repo.getMode() != null) {
jaxb.setMode(repo.getMode().getSchemaValue());
}
}

Expand All @@ -60,11 +58,11 @@ public boolean equals(Object o) {
if (!super.equals(o)) { return false; }

RTaskAutoScaling that = (RTaskAutoScaling) o;
return autoScalingMode == that.autoScalingMode;
return mode == that.mode;
}

@Override
public int hashCode() {
return Objects.hash(autoScalingMode);
return Objects.hash(mode);
}
}

0 comments on commit 9311163

Please sign in to comment.