far56 wrote:
Hibernate version:3.0.5
Name and version of the database you are using:Oracle 10g
This my program:
StringBuffer sf = new StringBuffer("");
sf.append(" from Parlamentar pl ");
sf.append(" join ( ");
sf.append(" select ipl.id from Parlamentar ipl where ipl.nomeCivil like ('%JOSE%') ");
sf.append(" union ");
sf.append(" select npl.id from Parlamentar npl where npl.nomesParlamentares.nomeParlamentar like ('%JOSE%') ");
sf.append(" ) np on pl.id = np.id ");
Query query = configuration.getCurrentSession().createQuery(sf.toString());
List colecao = query.list();
This my exception:
unexpected token: ( near line 1, column 71
This generate sql debug :
from br.gov.camara.procede.silegdep.comum.model.Parlamentar pl join ( select ipl.id from br.gov.camara.procede.silegdep.comum.model.Parlamentar ipl where ipl.nomeCivil like ('%sev%') union select npl.id from br.gov.camara.procede.silegdep.comum.model.Parlamentar npl where npl.nomesParlamentares.nomeParlamentar like ('%sev%') ) np on pl.id = np.id
What´s wrong?
Your query is invalid.
from Parlamentar pl join (???? What are you joining to ?
In HQL, joins must be to an associated object. For example,
Code:
from Parlamentar pl join pl.someAttribute sa
will join the Parlamentar table to the SomeAttribute table.