Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hypersistence Optimizer Issues: Critical: EagerFetchingEvent #2220

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public class CohortCharacterizationEntity extends CommonEntityExt<Long> implemen
@Column(name = "strata_only")
private Boolean strataOnly;

@OneToOne(mappedBy = "cohortCharacterization", cascade = CascadeType.ALL)
@OneToOne(mappedBy = "cohortCharacterization", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
private CcStrataConceptSetEntity conceptSetEntity;

@Column(name = "hash_code")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public CohortGenerationInfo(CohortDefinition definition, Integer sourceId)
@EmbeddedId
private CohortGenerationInfoId id;

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@MapsId("cohortDefinitionId")
@JoinColumn(name="id", referencedColumnName="id")
private CohortDefinition cohortDefinition;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class AnalysisFile {
@Column
private Long id;

@ManyToOne(optional = false)
@ManyToOne(optional = false, fetch = FetchType.LAZY)
@JoinColumn(name = "execution_id", nullable = false, updatable = false)
private ExecutionEngineAnalysisStatus analysisExecution;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class AnalysisResultFileContent {
@Column(name = "output_file_id")
private Long id;

@OneToOne
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "output_file_id")
@MapsId
private AnalysisResultFile analysisResultFile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public abstract class FeAnalysisCriteriaEntity implements WithId<Long> {
@Type(type = "org.hibernate.type.TextType")
private String expressionString;

@ManyToOne(fetch = FetchType.EAGER)
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "fe_aggregate_id")
private FeAnalysisAggregateEntity aggregate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
@Entity
public abstract class FeAnalysisWithCriteriaEntity<T extends FeAnalysisCriteriaEntity> extends FeAnalysisEntity<List<T>> implements FeatureAnalysisWithCriteria<T, Integer> {

@OneToMany(targetEntity = FeAnalysisCriteriaEntity.class, fetch = FetchType.EAGER, mappedBy = "featureAnalysis",
@OneToMany(targetEntity = FeAnalysisCriteriaEntity.class, fetch = FetchType.LAZY, mappedBy = "featureAnalysis",
cascade = {CascadeType.MERGE, CascadeType.REMOVE, CascadeType.REFRESH, CascadeType.DETACH})
private List<T> design;

@OneToOne(fetch = FetchType.EAGER, mappedBy = "featureAnalysis", cascade = CascadeType.ALL)
@OneToOne(fetch = FetchType.LAZY, mappedBy = "featureAnalysis", cascade = CascadeType.ALL)
private FeAnalysisConcepsetEntity conceptSetEntity;

public FeAnalysisWithCriteriaEntity() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MapsId;
Expand All @@ -42,13 +43,13 @@ public class StudyGenerationInfo implements Serializable {
private StudyGenerationInfoId id;

@JsonIgnore
@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@MapsId("studyId")
@JoinColumn(name="study_id", referencedColumnName="id")
private FeasibilityStudy study;

@JsonIgnore
@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@MapsId("sourceId")
@JoinColumn(name="source_id", referencedColumnName="source_id")
private Source source;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/ohdsi/webapi/ircalc/ExecutionInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ public class ExecutionInfo implements Serializable, IExecutionInfo {
private ExecutionInfoId id;

@JsonIgnore
@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@MapsId("analysisId")
@JoinColumn(name="analysis_id", referencedColumnName="id")
private IncidenceRateAnalysis analysis;

@JsonIgnore
@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@MapsId("sourceId")
@JoinColumn(name="source_id", referencedColumnName="source_id")
@NotFound(action = NotFoundAction.IGNORE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class IncidenceRateAnalysisDetails implements Serializable {
private Integer id;

@MapsId
@OneToOne
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name="id")
private IncidenceRateAnalysis analysis;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
Expand Down Expand Up @@ -37,11 +38,11 @@ public class RolePermissionEntity implements Serializable {
@Column(name = "STATUS")
private String status;

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="ROLE_ID", nullable=false)
private RoleEntity role;

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="PERMISSION_ID", nullable=false)
private PermissionEntity permission;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
Expand Down Expand Up @@ -58,7 +59,7 @@ public void setStatus(String status) {
this.status = status;
}

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="USER_ID", nullable=false)
public UserEntity getUser() {
return user;
Expand All @@ -68,7 +69,7 @@ public void setUser(UserEntity user) {
this.user = user;
}

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="ROLE_ID", nullable=false)
public RoleEntity getRole() {
return role;
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/org/ohdsi/webapi/source/SourceDaimon.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;

import java.io.Serializable;
import java.util.Objects;

Expand Down Expand Up @@ -65,7 +67,7 @@ public SourceDaimon(Source source) {
@Column(name="SOURCE_DAIMON_ID")
private int sourceDaimonId;

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JsonIgnore
@JoinColumn(name="SOURCE_ID", referencedColumnName="SOURCE_ID")
private Source source;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
Expand Down Expand Up @@ -40,11 +41,11 @@ public class RoleGroupEntity {
@Column(name = "group_name")
private String groupName;

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "role_id")
private RoleEntity role;

@ManyToOne()
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "job_id")
private UserImportJob userImportJob;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
attributeNodes = @NamedAttributeNode("roleGroupMapping"))
public class UserImportJob extends ArachneJob {

@ElementCollection(fetch = FetchType.EAGER)
@ElementCollection(fetch = FetchType.LAZY)
@CollectionTable(name = "user_import_job_weekdays", joinColumns = @JoinColumn(name = "user_import_job_id"))
@Column(name = "day_of_week")
@Enumerated(EnumType.STRING)
Expand Down