We use criterias to query an Informix server, it seems that InformixDialect correctly interprets setMaxresults() (see "first ?" on the generated SQL below), but the server throws an incorrect sql exception.
We couldn't find any information about that, maybe we can issue a bug report?
Thanks for your help.
Hibernate version: 2.1.6
Database: Informix
Criteria used:
Code:
Criteria c = HibernateUtil.getSession().createCriteria( Atto.class );
c.add( Expression.eq( "id" , new Long(codiceIdentificativo) ) );
c.add( Expression.like( "descrizione" , ta.getDescrizione()
c.add( Expression.eq( "leggeCollegata" , lc ) );
c.add( Expression.like( "dittaProvenienza" , "%" + provenienza + "%" ) );
c.add( Expression.ge( "data" , Convert.stringToDate(dataAttoDa) ) );
c.add( Expression.le( "data" , Convert.stringToDate(dataAttoA) ) );
c.add( Expression.like( "note" , "%" + note + "%" ) );
c.setMaxResults( 100 );
List lista = c.list();
The generated SQL (show_sql=true):Code:
select first ? this.id as id5_, this.tipo_atto as tipo_atto5_, this.descrizione as descrizi3_5_, this.data as data5_, this.ditta_provenienza as ditta_pr5_5_, this.numero_registrazione as numero_r6_5_, this.data_registrazione as data_reg7_5_, this.id_comune_registrazione as id_comun8_5_, this.numero_trascrizione as numero_t9_5_, this.data_trascrizione as data_tr10_5_, this.id_comune_trascrizione as id_comu11_5_, this.notaio as notaio5_, this.agli_atti as agli_atti5_, this.note as note5_, this.importo as importo5_, this.id_legge_collegata as id_legg16_5_, this.attiva as attiva5_, this.id_tipo_servitu as id_tipo18_5_, this.reversale as reversale5_, this.data_reversale as data_re20_5_, this.id_titolare_servitu as id_tito21_5_, this.acquirente as acquirente5_, this.venditore as venditore5_, comune1_.id as id0_, comune1_.nome as nome0_, comune1_.provincia as provincia0_, comune1_.sigla_provincia as sigla_pr4_0_, comune1_.codice as codice0_, comune2_.id as id1_, comune2_.nome as nome1_, comune2_.provincia as provincia1_, comune2_.sigla_provincia as sigla_pr4_1_, comune2_.codice as codice1_, leggecolle3_.id as id2_, leggecolle3_.legge as legge2_, tiposervit4_.id as id3_, tiposervit4_.descrizione as descrizi2_3_, titolare5_.id as id4_, titolare5_.descrizione as descrizi2_4_ from atto this left outer join comune comune1_ on this.id_comune_registrazione=comune1_.id left outer join comune comune2_ on this.id_comune_trascrizione=comune2_.id left outer join legge_collegata leggecolle3_ on this.id_legge_collegata=leggecolle3_.id left outer join tipo_servitu tiposervit4_ on this.id_tipo_servitu=tiposervit4_.id left outer join titolare titolare5_ on this.id_titolare_servitu=titolare5_.id where 1=1