1
I have the following problem when conducting a bank consultation with HQL
The table tabela1 has approximately 20000 records.
The other tables have "N" records.
The table tabela1 has relationships with other tables tabela2, tabela3 and tabela4.
When executing this command below I expected the return value to be the value equal to the number of records in the tabela 1, but I’m doing something wrong with the JOINS because the command returns me a number greater than 200000 ;
select distinct count(t.id)
from tabela1 t
left join t.tabela2 t2
left join t.tabela3 t3
left join t.tabela4 t4
where t2.campoInteiro >-1 ;
The tables are like this:
@OneToMany(cascade = CascadeType.ALL)
List<Tabela2> tabela2;
@OneToMany(cascade = CascadeType.ALL)
List<Tabela3> tabela3;
@OneToMany(cascade = CascadeType.ALL)
List<Tabela4> tabela4;
Managed to solve?
– Dherik