diff --git a/src/main/java/org/ohdsi/webapi/cohortcharacterization/DropCohortTableListener.java b/src/main/java/org/ohdsi/webapi/cohortcharacterization/DropCohortTableListener.java index b09bae7b8..70f24a8c3 100644 --- a/src/main/java/org/ohdsi/webapi/cohortcharacterization/DropCohortTableListener.java +++ b/src/main/java/org/ohdsi/webapi/cohortcharacterization/DropCohortTableListener.java @@ -41,7 +41,7 @@ private Object doTask(JobParameters parameters) { /* final Map jobParameters = parameters.getParameters(); MDACA Spring Boot 3 migration compilation issue */ final Map> jobParameters = parameters.getParameters(); - final Integer sourceId = Integer.valueOf(jobParameters.get(SOURCE_ID).toString()); + final Integer sourceId = Integer.valueOf(jobParameters.get(SOURCE_ID).getValue().toString()); final String targetTable = jobParameters.get(TARGET_TABLE).getValue().toString(); final String sql = sourceAwareSqlRender.renderSql(sourceId, DROP_TABLE_SQL, TARGET_TABLE, targetTable ); diff --git a/src/main/java/org/ohdsi/webapi/feanalysis/domain/CriteriaColumnListConverter.java b/src/main/java/org/ohdsi/webapi/feanalysis/domain/CriteriaColumnListConverter.java new file mode 100644 index 000000000..bd9d68550 --- /dev/null +++ b/src/main/java/org/ohdsi/webapi/feanalysis/domain/CriteriaColumnListConverter.java @@ -0,0 +1,37 @@ +package org.ohdsi.webapi.feanalysis.domain; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +import org.ohdsi.circe.cohortdefinition.builders.CriteriaColumn; + +import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; + +@Converter +public class CriteriaColumnListConverter implements AttributeConverter, String> { + + private static final String DELIMITER = ","; + + @Override + public String convertToDatabaseColumn(List attribute) { + if (attribute == null || attribute.isEmpty()) { + return null; + } + return attribute.stream() + .map(CriteriaColumn::name) // Convert enum to its string name + .collect(Collectors.joining(DELIMITER)); + } + + @Override + public List convertToEntityAttribute(String dbData) { + if (dbData == null || dbData.isEmpty()) { + return Collections.emptyList(); + } + return Arrays.stream(dbData.split(DELIMITER)) + .map(CriteriaColumn::valueOf) // Convert string name back to enum + .collect(Collectors.toList()); + } +} \ No newline at end of file diff --git a/src/main/java/org/ohdsi/webapi/feanalysis/domain/FeAnalysisAggregateEntity.java b/src/main/java/org/ohdsi/webapi/feanalysis/domain/FeAnalysisAggregateEntity.java index 354a1ae68..80e17d28e 100644 --- a/src/main/java/org/ohdsi/webapi/feanalysis/domain/FeAnalysisAggregateEntity.java +++ b/src/main/java/org/ohdsi/webapi/feanalysis/domain/FeAnalysisAggregateEntity.java @@ -16,14 +16,12 @@ import jakarta.persistence.*; import java.util.List; - +import java.util.List; @Entity @Table(name = "fe_analysis_aggregate") -// @TypeDef(typeClass = EnumListType.class, name = "enumm-list") MDACA Spring Boot 3 migration compilation issue -@Convert(attributeName = "enumm-list", converter = EnumListType.class) public class FeAnalysisAggregateEntity implements FeatureAnalysisAggregate, WithId { - - @Id + + @Id @GenericGenerator( name = "fe_aggregate_generator", strategy = "org.hibernate.id.enhanced.SequenceStyleGenerator", @@ -65,13 +63,10 @@ public class FeAnalysisAggregateEntity implements FeatureAnalysisAggregate, With @Column(name = "missing_means_zero") private boolean isMissingMeansZero; + @Column(name = "criteria_columns") -/* MDACA Spring Boot 3 migration compilation issue, see package-info.java - @Type(value = enumm-list.class, parameters = { - @Parameter(name = "enumClass", value = "org.ohdsi.circe.cohortdefinition.builders.CriteriaColumn") - }) -*/ - private List columns; + @Convert(converter = CriteriaColumnListConverter.class) +private List columns; @Override public Integer getId() { diff --git a/src/main/java/org/ohdsi/webapi/feanalysis/domain/FeAnalysisEntity.java b/src/main/java/org/ohdsi/webapi/feanalysis/domain/FeAnalysisEntity.java index 1787ac975..0fcd9a4e0 100644 --- a/src/main/java/org/ohdsi/webapi/feanalysis/domain/FeAnalysisEntity.java +++ b/src/main/java/org/ohdsi/webapi/feanalysis/domain/FeAnalysisEntity.java @@ -31,10 +31,7 @@ @Table(name = "fe_analysis") @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorFormula( - """ - CASE WHEN type = 'CRITERIA_SET' THEN CONCAT(CONCAT(type,'_'),stat_type) \ - ELSE type END\ - """ + "CASE WHEN type = 'CRITERIA_SET' THEN CONCAT(CONCAT(type,'_'),stat_type) ELSE type END" ) public abstract class FeAnalysisEntity extends CommonEntity implements FeatureAnalysis, Comparable> { @@ -71,7 +68,6 @@ public FeAnalysisEntity(final FeAnalysisEntity entityForCopy) { @Column private String name; - @Lob @Column(name = "design", insertable = false, updatable = false) private String rawDesign; diff --git a/src/main/java/org/ohdsi/webapi/feanalysis/domain/FeAnalysisWithStringEntity.java b/src/main/java/org/ohdsi/webapi/feanalysis/domain/FeAnalysisWithStringEntity.java index 7216ed94e..d45e820ef 100644 --- a/src/main/java/org/ohdsi/webapi/feanalysis/domain/FeAnalysisWithStringEntity.java +++ b/src/main/java/org/ohdsi/webapi/feanalysis/domain/FeAnalysisWithStringEntity.java @@ -1,5 +1,6 @@ package org.ohdsi.webapi.feanalysis.domain; +import jakarta.persistence.Column; import jakarta.persistence.DiscriminatorValue; import jakarta.persistence.Entity; import jakarta.persistence.Lob; @@ -15,8 +16,8 @@ public FeAnalysisWithStringEntity() { public FeAnalysisWithStringEntity(final FeAnalysisWithStringEntity analysis) { super(analysis); } - - @Lob + + @Column private String design; @Override