Add transction

This commit is contained in:
Paulo Gustavo Veiga 2023-11-20 19:37:08 -08:00
parent 60923e4c8b
commit 538083ae83
3 changed files with 4 additions and 2 deletions

View File

@ -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<Collaboration> collaborations = new HashSet<>();

View File

@ -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")

View File

@ -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)}
*/