Hello.
Maybe, this is a silly question, but I’m really in doubt.
I’m working in a company where the older developer which starts the project, use the enable_lazy_load_no_trans property.
I always notice some performance issues in the whole software, but now I tried to process a lot of data and I have a lot of issues.
So after read: this, I understand the issues.
So the problem is, I removed this property and now I’m changing the @NamedQueries and creating DTO when it’s necessary.
But I’m getting the Fetch Multiples Bags exception, I read this and a lot of others topics in StackOverflow and Vlad’s blog, and I know that if I change one of them to Set it’ll work.
My question is: When should I use Set or List or what else? Is there any “pattern” or best performance choice?
Is there any recommendation for each of them?
For example:
@NamedQuery(name = "Usuario.fetchByLogin", query = "SELECT u FROM Usuario u WHERE UPPER(u.apelido) = UPPER(:apelido) AND u.senha = :senha AND u.ativo = true")
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name = "permissoes_usuarios_grupos", joinColumns = {
@JoinColumn(name = "usuario_id", nullable = false, insertable = false, updatable = false)
}, inverseJoinColumns = {
@JoinColumn(name = "grupo_id", nullable = false, insertable = false, updatable = false)
})
private List<PermissaoGrupo> grupos;
@OneToMany(mappedBy = "usuario", cascade = CascadeType.ALL, orphanRemoval = true)
private List<UsuarioPessoa> pessoas;
Thanks in advance and I’m sorry for the long text.