Hibernate version:3.1.3
Name and version of the database you are using:oracle 10.1
Spring 1.2 (hibernateDAOSupport)
Hi,
When i execute this part of code :
requete = requete.append(" SELECT new com.truc.machin.srv.domain.wrapper.FileDetailsEFWrapper(count(factrace.Fact.Id),factrace.Fictra.Jalon.JalonLib,factrace.Fictra.FictraDtPassage,factrace.Fictra.FictraEtat,facetat.FacetatLib,factrace.FactraDtReponseAmc,anomalie.Id,anomalie.AnoLib) ") ;
requete = requete.append(" FROM Factrace as factrace LEFT JOIN factrace.Facetat as facetat LEFT JOIN factrace.Ano as anomalie ") ;
requete = requete.append(" WHERE factrace.Lot.Flux.Fic.Id=:ficId AND factrace.Fictra.Jalon.Id = (SELECT MAX(factrace2.Fictra.Jalon.Id) FROM Factrace as factrace2 WHERE factrace2.Fact.Id=factrace.Fact.Id)) ") ;
requete = requete.append(" GROUP BY factrace.Fictra.Jalon.JalonLib,factrace.Fictra.FictraDtPassage,factrace.Fictra.FictraEtat,facetat.FacetatLib,factrace.FactraDtReponseAmc,anomalie.Id,anomalie.AnoLib ") ;
System.out.println(requete.toString());
Query query = getSession().createQuery(requete.toString());
query=query.setLong("ficId",ficId) ;
ArrayList<FileDetailsEFWrapper> lst = (ArrayList<FileDetailsEFWrapper>)query.list() ;
I obtain the following error :
Hibernate:
select
count(factrace0_.FACT_ID) as col_0_0_,
jalon4_.JALON_LIB as col_1_0_,
fictrace3_.FICTRA_DT_PASSAGE as col_2_0_,
fictrace3_.FICTRA_ETAT as col_3_0_,
facetat1_.FACETAT_LIB as col_4_0_,
factrace0_.FACTRA_DT_REPONSE_AMC as col_5_0_,
anomalie2_.ANO_ID as col_6_0_,
anomalie2_.ANO_LIB as col_7_0_
from
FACTRACE factrace0_
left outer join
FACETAT facetat1_
on factrace0_.FACETAT_ID=facetat1_.FACETAT_ID
left outer join
ANOMALIE anomalie2_
on factrace0_.ANO_ID=anomalie2_.ANO_ID,
FICTRACE fictrace3_,
JALON jalon4_,
LOT lot7_,
FLUX flux8_
where
lot7_.FLUX_ID=flux8_.FLUX_ID
and factrace0_.LOT_ID=lot7_.LOT_ID
and fictrace3_.JALON_ID=jalon4_.JALON_ID
and factrace0_.FICTRA_ID=fictrace3_.FICTRA_ID
and flux8_.FIC_ID=?
and fictrace3_.JALON_ID=(
select
MAX(fictrace11_.JALON_ID)
from
FACTRACE factrace10_,
FICTRACE fictrace11_
where
factrace10_.FICTRA_ID=fictrace11_.FICTRA_ID
and factrace10_.FACT_ID=factrace0_.FACT_ID
)
4000 WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 937, SQLState: 42000
4000 ERROR org.hibernate.util.JDBCExceptionReporter - ORA-00937: not a single-group group function
The group by clause seem not to be translated to SQL ...
So, an error occured.
Is there a problem in my HQL query ?
Is it a well known hibernate parser bug or is it a bug ?
Thks for your help
ps : the "System.out.println(requete.toString());" show me the right HQL query
|