fix lazy initialization error.

main
Paulo Gustavo Veiga 2023-11-20 07:27:56 -08:00
parent 92edef9bd6
commit 55c104cfbe
2 changed files with 3 additions and 1 deletions

View File

@ -65,7 +65,7 @@ public class Mindmap implements Serializable {
@Column(name = "public") @Column(name = "public")
private boolean isPublic; private boolean isPublic;
@OneToMany(mappedBy = "mindMap", orphanRemoval = true, cascade = {CascadeType.ALL}, fetch = FetchType.LAZY) @OneToMany(mappedBy = "mindMap", orphanRemoval = true, cascade = {CascadeType.ALL}, fetch = FetchType.EAGER)
@Fetch(FetchMode.JOIN) @Fetch(FetchMode.JOIN)
private Set<Collaboration> collaborations = new HashSet<>(); private Set<Collaboration> collaborations = new HashSet<>();

View File

@ -24,6 +24,7 @@ import com.wisemapping.rest.model.*;
import com.wisemapping.security.Utils; import com.wisemapping.security.Utils;
import com.wisemapping.service.*; import com.wisemapping.service.*;
import com.wisemapping.validator.MapInfoValidator; import com.wisemapping.validator.MapInfoValidator;
import jakarta.transaction.Transactional;
import org.apache.commons.validator.routines.EmailValidator; import org.apache.commons.validator.routines.EmailValidator;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -47,6 +48,7 @@ import java.util.stream.Collectors;
@Controller @Controller
@Transactional
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
public class MindmapController extends BaseController { public class MindmapController extends BaseController {
final Logger logger = LogManager.getLogger(); final Logger logger = LogManager.getLogger();