|Query work in 2.0.1 but don't in 2.3.2 [message #816946]
||Fri, 09 March 2012 12:58
| Luciano Edson Mertins
Registered: March 2012
I'm migrating a system from Glassfish 3.0.1/EclipseLink 2.0.1.v20100213-r6600 to Glassfish 3.1.2/EclipseLink 2.3.2.v20111125-r10461 and find some problems with JPA.
In a few I managed workarounds, but there is a namedquery that I couldn't:
select u from Representante u
where exists (select pj from PessoaJuridica pj where pj=u.pessoa and upper(pj.agrupamentoPJ.razaoSocial) like :descricao)
or exists (select pf from PessoaFisica pf where pf=u.pessoa and upper(pf.nome) like :descricao)
Representante extends Distribuidor that extends EntidadeIntegradaPessoa that have a @OneToOne with Pessoa
PessoaJuridica extends Pessoa
PessoaFisica extends Pessoa
All tables names have prefix GER or ESTG plus class name
The query above want to find Representante that have association with PessoaFisica or PessoaJuridica with some text description.
With EclipseLink 2.0.1 is working, but EclipseLink 2.3.2 I have this sql error :
SELECT t0.ID, t0.DTYPE, t0.ATIVO, t0.OPTIMISTICLOCK, t1.ID, t1.PESSOA_ID, t2.ID, t2.ALCANCE, t2.CALCULOCOMISSAO, t2.COMISSAO, t2.DESCRICAO, t2.GERARCARGA, t2.LANC, t2.LIMITEDESCONTO, t2.LOTEPEDIDOS, t2.NOME, t2.NRPEDFINAL, t2.NRPEDINICIAL, t2.RECEBECOMISSAO, t2.SENHALIBERACAO, t2.STATUS, t2.TABELAPRECO_ID, t3.ID, t3.ALTERARPV, t3.SUPERVISOR, t3.ID_SUP
FROM ESTGREPRESENTANTE t3, ESTGDISTRREPRES t2, ESTGENTIDADEINTEGRADAPESSOA t1, ESTGENTIDADEINTEGRADA t0
WHERE ((EXISTS (SELECT ?
FROM GERPESSOAJURIDICA t5, GERPESSOA t4, GERAGRUPAMENTOPJ t6
WHERE ((((t4.ID = t1.PESSOA_ID)
AND UPPER(t6.RAZAOSOCIAL) LIKE ?)
AND ((t5.ID = t4.ID)
AND (t4.DTYPE = ?)))
AND (t6.NUMEROCNPJ = t5.NUMEROCNPJ))
OR EXISTS (SELECT ?
FROM GERPESSOAFISICA t8, GERPESSOA t7
======>>>> WHERE (((t4.ID = t1.PESSOA_ID)
AND UPPER(t8.NOME) LIKE ?)
AND ((t8.ID = t7.ID)
AND (t7.DTYPE = ?))))
AND (((t3.ID = t0.ID)
AND ((t2.ID = t0.ID)
AND (t1.ID = t0.ID)))
AND (t0.DTYPE = ?)))
ERROR: missing FROM-clause entry for table "t4"
LINHA 13: WHERE (((t4.ID = t1.PESSOA_ID)
This query is wrong. t4 should be replaced by t7
[Updated on: Fri, 09 March 2012 13:00]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.02749 seconds