-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate Criteria grouping
PostPosted: Sun Nov 01, 2009 8:44 am 
Newbie

Joined: Fri Apr 06, 2007 8:01 am
Posts: 2
Dear All,
i have a problem in criteria API
there is a bug in this criteria when i using it with grouping like

Criteria criteria = session.createCriteria(VesselMove.class, "vm");
criteria.add(Restrictions.eq("vm.agentId", agentId));
criteria.setProjection(Projections.max("vm.toDate"));
criteria.setProjection(Projections.property("vm.visitId"));
criteria.setProjection(Projections.projectionList()
.add(Projections.groupProperty("vm.visitId"))

);
List<Object> result = criteria.list();

this must generate sql like
select max(vm.toDate), vm.visitId from VesselMove where vm.agentId = ?
group by visitId

but the generated SQL is
select vm.visitId from VesselMove where vm.agentId = ?
group by visitId

where tha max(vm.toDate) is disappear?

Thanks.

_________________
ahmed ali
Developer at ISFP company


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.