Last active
November 7, 2016 13:15
-
-
Save bocato/7a468441b476e762d1a9 to your computer and use it in GitHub Desktop.
Fugindo do Erro de Lazy no Hibernate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public List<Task> findAllByProcess(Long processId) throws SGPIException { | |
/** | |
* Como ProcessDefinition é um relacionamento com fetchType=LAZY, se eu passar uma lista e | |
* depois tentar pedir algum parametro desta lista ele será obrigado | |
* a instanciar o objeto, portanto passa a ser acessível e não vai | |
* mais dar erro de LAZY. | |
* */ | |
List<Task> tasks = taskRepository.findAllByProcess(processId); | |
for (Task task : tasks) { | |
task.getProcessDefinition().getIdProcessDefinition(); | |
} | |
return tasks; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment