I'm getting the folowing generated SQL from a formula. The only problem with it is that the UNION operator is getting a "this_" appended. I've already read that formula suports "SQL Expression", so i'm confused if UNION is not supported in this context, or if i'm doing something wrong?
If it is not supported, is there any way to avoid de formula parser from appending "this", in an arbritary portion of the formula SQL ?
Thanks in advance.
Hibernate version: 3.0.5
Name and version of the database you are using:Oracle 9i
The generated SQL (show_sql=true):
select * from ( select this_.UNNE_CD_N1710 as UNNE1_0_, this_.UNNE_NM_UNIDADE as UNNE2_4_0_, this_.UNNE_NR_CNPJ as UNNE3_4_0_, (select * from (( select tip.tico_nm_tipo_combustivel from tipo_combustivel tip, turbina turbina, bloco_turbina blo, bloco bloco, fase fase, empreendimento emp, unidade_negocio uni where tip.tico_cd_tipo_combustivel = turbina.tico_cd_tipo_combustivel AND (turbina.turb_cd_turbina = blo.turb_cd_turbina) AND (bloco.bloc_cd_bloco = blo.bloc_cd_bloco) AND (fase.fase_cd_fase = bloco.fase_cd_fase) AND (emp.empr_cd_empreendimento = fase.empr_cd_empreendimento) AND (uni.unne_cd_n1710 = emp.unne_cd_n1710) AND (uni.unne_cd_n1710 = uni.unne_cd_n1710) and uni.unne_cd_n1710 = (select uni.unne_cd_n1710 from tipo_combustivel tip, turbina turbina, bloco_turbina blo, bloco bloco, fase fase, empreendimento emp, unidade_negocio uni where ((tip.tico_cd_tipo_combustivel = turbina.tico_cd_tipo_combustivel) AND (turbina.turb_cd_turbina = blo.turb_cd_turbina) AND (bloco.bloc_cd_bloco = blo.bloc_cd_bloco) AND (fase.fase_cd_fase = bloco.fase_cd_fase) AND (emp.empr_cd_empreendimento = fase.empr_cd_empreendimento) AND (uni.unne_cd_n1710 = emp.unne_cd_n1710) AND (uni.unne_cd_n1710 = uni.unne_cd_n1710) and (uni.unne_cd_n1710 = uni.unne_cd_n1710)) group by uni.unne_cd_n1710 having count(uni.unne_cd_n1710) = 1 )) this_.UNION ALL ( select 'bi-combustivel' from dual)) where rownum = 1) as formula0_0_ from UNIDADE_NEGOCIO this_ where this_.UNNE_CD_N1710 like ? and this_.UNNE_NM_UNIDADE like ? order by this_.UNNE_NM_UNIDADE asc ) where rownum <= ?
|