According the article suggested, i simplified the hql query
before:
"select distinct pratica from PraticaBean as pratica " + "left join fetch pratica.zona " + "left join fetch pratica.dettagliPratica " + "left join fetch pratica.abusi ab " + "left join fetch ab.caratteristiche " + "left join fetch ab.naturaDelVincolo " + "left join fetch ab.comunicante " + "left join fetch ab.interessato " + "left join fetch ab.utente " + "left join fetch ab.pratica " + "left join fetch ab.stato " + "left join fetch ab.zonaOmogenea " + "left join fetch ab.paragrafo " + "left join fetch ab.paragrafo.articolo " + "left join fetch ab.particelleCatastali " + "left join fetch ab.soggetti "
after I split the query in :
String sqlQuery = "select " + "ab.id, " + "ab.pratica.numero, " + "ab.pratica.zona.comune, " + "ab.paragrafo.articolo.nome, " + "ab.descrizione, " + "ab.localita " + " from AbusoLazyBean as ab";
and for each entry of the previuos select I perform
String sqlQuerySoggetti = "select " + "soggetto.tipo, " + "soggetto.nome, " + "soggetto.cognome " + "from SoggettoBean as soggetto " + "where abuso.id=" + idAbuso;
this resolve one join
but I didn't reach the target I have with java application
first sql in java application it takes 300 msec first sql in web applicationit takes 75 sec the combination of second and third query take 11 sec
Could you help me to improve the performance?
Nicola
|