Skip to content

Commit 84422db

Browse files
Fix feature analysis endpoint (#2437)
Add Transactional annotation to method to fix "no session" error
1 parent 27d8b5a commit 84422db

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

src/main/java/org/ohdsi/webapi/feanalysis/FeAnalysisController.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ public void deleteAnalysis(@PathParam("id") final Integer feAnalysisId) {
153153
* @return ID, type, name domain, description, etc of feature analysis
154154
*/
155155
@GET
156+
@Transactional
156157
@Path("/{id}")
157158
@Produces(MediaType.APPLICATION_JSON)
158159
public FeAnalysisDTO getFeAnalysis(@PathParam("id") final Integer feAnalysisId) {

src/main/java/org/ohdsi/webapi/feanalysis/converter/FeAnalysisEntityToFeAnalysisDTOConverter.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import org.ohdsi.webapi.feanalysis.dto.*;
88
import org.springframework.beans.factory.annotation.Autowired;
99
import org.springframework.stereotype.Component;
10+
import org.hibernate.Hibernate;
1011

1112
import java.util.List;
1213
import java.util.Objects;
@@ -46,6 +47,7 @@ private Object convertDesignToJson(final FeAnalysisEntity source) {
4647
switch (source.getType()) {
4748
case CRITERIA_SET:
4849
FeAnalysisWithCriteriaEntity<?> sourceWithCriteria = (FeAnalysisWithCriteriaEntity<?>) source;
50+
Hibernate.initialize(sourceWithCriteria.getDesign()); // Explicitly initialize the collection
4951
return sourceWithCriteria.getDesign()
5052
.stream()
5153
.map(this::convertCriteria)

0 commit comments

Comments
 (0)