Hibernate e la generazione di query…

SELECT * FROM (SELECT THIS_.CC120_PG AS T1_1_5_,
THIS_.CC120_PG_OWN AS T2_1_5_, THIS_.CC120_UNI_AMM AS T3_1_5_,
THIS_.ID1 AS T4_1_5_, THIS_.CC120_TP_GES AS T5_1_5_,
THIS_.CC120_DESC AS T6_1_5_, THIS_.CC120_QTA AS T7_1_5_,
THIS_.CC120_NUM AS T8_1_5_, THIS_.CC120_VAL AS T9_1_5_,
THIS_.CC120_ASS AS TT110_1_5_, THIS_.CC120_NOTE AS T11_1_5_,
THIS_.CC120_VAL_EURO AS CC120_1_5_, THIS_.CC120_ASS_EURO AS T13_1_5_,
T1_.TT110_PG AS T1_6_0_, T1_.MOVI AS T2_6_0_,
T1_.TCAT AS T3_6_0_, T1_.CDC AS T4_6_0_,
T1_.TT110_BEN AS T5_6_0_, T1_.TT110_FLG_PRO AS T6_6_0_,
T1_.TT110_UNI_AMM AS T7_6_0_, T1_.ANNO AS T8_6_0_,
T1_.TT110_CDC AS T9_6_0_, T1_.TT110_NUM AS TT110_6_0_,
T1_.DATA AS T11_6_0_, T1_.TT110_IMP AS CC120_6_0_,
T1_.ANNO_IMP AS T13_6_0_, T1_.TCAT_CAP AS T14_6_0_,
T1_.TT110_FONDO AS T15_6_0_, T1_.TT110_NUMERO AS T16_6_0_,
T1_.ANN AS T17_6_0_, T1_.TT110_NOTE AS T18_6_0_,


MOVIM5_.ZZ033_CODICE AS T1_0_1_, MOVIM5_.ZZ033_DESC AS T2_0_1_,
MOVIM5_.ZZ033_CONT AS T3_0_1_, MOVIM5_.ZZ033_FLG_SMALT AS T4_0_1_,
CAT.ID2 AS T1_2_2_, CAT.HH0113_DESC AS T2_2_2_,
CAT.HH0113_TRANSITORIO AS T3_2_2_, CAT.HH0113_COSTI_RICAVI AS T4_2_2_,
CAT.HH0113_IMMOB AS T5_2_2_, CAT.HH0113_ORDINE AS T6_2_2_,
CAT.HH0113_FLG_RIGHE AS T7_2_2_, CAT.HH0113_TIPO AS T8_2_2_,
STR3_.CD_CDC AS CD1_7_3_, STR3_.CD_ZONA AS CD2_7_3_,
STR3_.UNITA AS CD3_7_3_, STR3_.DESCR AS DESCR7_3_,
STR3_.INDI_STR AS INDI5_7_3_, STR3_.CAP AS CAP7_3_,
ZONE4_.CD_ZONA AS CD1_9_4_, ZONE4_.DES_ZONA AS DES2_9_4_,
ZONE4_.DIS_SEQ AS DIS3_9_4_, ZONE4_.UNIQUE_SEQ AS UNIQUE4_9_4_,
ZONE4_.DT_ATT AS DT5_9_4_, ZONE4_.DT_DIS AS DT6_9_4_,
ZONE4_.TIMESTAMPS AS TIMESTAMPS9_4_ FROM ARC.CC120_RIGA THIS_
INNER JOIN ARC.BUO T1_ ON THIS_.CC120_PG_OWN = T1_.TT110_PG
INNER JOIN ARC.ZZ033_MOVIM MOVIM5_ ON T1_.MOVI = MOVIM5_.ZZ033_CODICE
INNER JOIN ARC.HH0113_CATINV CAT ON T1_.TCAT = CAT.ID2
INNER JOIN ARC.VW_SMALT_STRU STR3_ ON T1_.CDC = STR3_.CD_CDC
INNER JOIN ARC.ZONE ZONE4_ ON STR3_.CD_ZONA = ZONE4_.CD_ZONA
WHERE T1_.CDC IN (?,?,?,?, ?,?,?,?, ?,?,?,?, ?,?,?,?, ?,?,?,?, ?,?,?,?,
?,?,?,?, ?,?,?,?, ?,?,?,?, ?,?,?,?, ?,?,?,?, ?,?,?,?, ?,?,?,?, ?,?,?,?, ?,?,?,?,
?,?,?,?, ?,?,?,?, ?,?,?,?, ?,?,?,?, ?,?,?,?, ?,?,?,?, ?,?,?,?, ?,?,?,?, ?,?,?,?,
?,?,?,?, ?,?,?,?, ?,?,?,?) AND T1_.ANNO <=? AND T1_.ANNO >=? AND T1_.MOVI >=?
AND T1_.MOVI =? AND ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR ((THIS_.ID1 =? AND CAT.ID2 =?) OR ((THIS_.ID1 =?
AND CAT.ID2 =?) OR (THIS_.ID1 =?
AND CAT.ID2 =?)))))))))))))))))))))))))))))))))))))))))))))))))))))
)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
AND T1_.ANN =? ORDER BY T1_.ANNO DESC, T1_.DATA DESC) WHERE ROWNUM
<= ?
Che dite … si puo ottimizzare ? Qualche idea ce l’ho … resta da vedere come spiegarle al suddetto ORM

P.S. : Ne caso ve lo state chiedendo, sono circa 11000 caratteri di query e 608 parametri.

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

Questo sito usa Akismet per ridurre lo spam. Scopri come i tuoi dati vengono elaborati.