sql - DetachedCriteria Hibernate returning more than one field -


i trying write query inner select inner select must have min , group . able writing if seems fine- problem detachedcriteria adding grouped select dont need

the generated inner select looks like:

     this_.lz_dynamic_stats_id in (select                 min(this_.lz_dynamic_stats_id) y0_,                 this_.brand_data_source_instance_id y1_                              lz_dynamic_stats this_              inner join                 brand_data_source_instances branddatas1_                      on this_.brand_data_source_instance_id=branddatas1_.brand_data_source_instance_id                              branddatas1_.brand_data_source_instance_id in (                     ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?                 )              group                 this_.brand_data_source_instance_id 

the problem dont want this_.brand_data_source_instance_id y1_ in inner select - want on group , where.

how can make work?

protected detachedcriteria createdetachedcriteria() {     return return detachedcriteria.forclass(somejobs.class); }   set<integer> taskids = .....      detachedcriteria minid1 = createdetachedcriteria();     minid1.createcriteria("branddatasourceinstance").add(restrictions.in("id", bdsiids));     minid1.setprojection(projections.projectionlist().add(projections.groupproperty("branddatasourceinstance.id")).add(projections.min("id"),"id"));     criteria crit = getdtocriteria();     //minid1.setprojection(projections.projectionlist().add(projections.min("id"),"this_.xxxx").add(projections.groupproperty("branddatasourceinstance.id")));         crit.add(property.forname("id").in(minid1));         return crit.list(); 

the sub query output :


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -