From 538083ae839c4ff4395af28fd113aa68b91df072 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Mon, 20 Nov 2023 19:37:08 -0800 Subject: [PATCH] Add transction --- wise-webapp/src/main/java/com/wisemapping/model/Mindmap.java | 2 +- .../main/java/com/wisemapping/webmvc/MvcMindmapController.java | 3 +++ wise-webapp/src/main/webapp/WEB-INF/views/reactInclude.jsp | 1 - 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/wise-webapp/src/main/java/com/wisemapping/model/Mindmap.java b/wise-webapp/src/main/java/com/wisemapping/model/Mindmap.java index 64253a33..5c273b83 100644 --- a/wise-webapp/src/main/java/com/wisemapping/model/Mindmap.java +++ b/wise-webapp/src/main/java/com/wisemapping/model/Mindmap.java @@ -65,7 +65,7 @@ public class Mindmap implements Serializable { @Column(name = "public") private boolean isPublic; - @OneToMany(mappedBy = "mindMap", orphanRemoval = true, cascade = {CascadeType.ALL}, fetch = FetchType.EAGER) + @OneToMany(mappedBy = "mindMap", orphanRemoval = true, cascade = {CascadeType.ALL}, fetch = FetchType.LAZY) @Fetch(FetchMode.JOIN) private Set collaborations = new HashSet<>(); diff --git a/wise-webapp/src/main/java/com/wisemapping/webmvc/MvcMindmapController.java b/wise-webapp/src/main/java/com/wisemapping/webmvc/MvcMindmapController.java index 9622d162..bfca1266 100644 --- a/wise-webapp/src/main/java/com/wisemapping/webmvc/MvcMindmapController.java +++ b/wise-webapp/src/main/java/com/wisemapping/webmvc/MvcMindmapController.java @@ -36,6 +36,8 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.stereotype.Controller; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @@ -46,6 +48,7 @@ import org.springframework.web.servlet.ModelAndView; import java.util.Locale; @Controller +@Transactional(propagation = Propagation.REQUIRED) public class MvcMindmapController { @Qualifier("mindmapService") diff --git a/wise-webapp/src/main/webapp/WEB-INF/views/reactInclude.jsp b/wise-webapp/src/main/webapp/WEB-INF/views/reactInclude.jsp index 197cbf19..31797231 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/views/reactInclude.jsp +++ b/wise-webapp/src/main/webapp/WEB-INF/views/reactInclude.jsp @@ -27,7 +27,6 @@ <%-- Hack to force view selection on react to move all the UI to react --%> window.errorMvcView = '${requestScope['exception']!=null?(fn:indexOf(requestScope['exception'],'SecurityException') gt 1?'securityError':'unexpectedError'):''}'; /* - ${requestScope['exception']} ${requestScope['exception'].printStackTrace(pageContext.response.writer)} ${requestScope['javax.servlet.error.exception'].printStackTrace(pageContext.response.writer)} */