-->
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.  [ 2 posts ] 
Author Message
 Post subject: invalid sql when using projection and restriction
PostPosted: Tue Oct 21, 2008 11:46 am 
Beginner
Beginner

Joined: Tue Nov 06, 2007 5:13 am
Posts: 28
Hibernate version: 3.3.2.GA

the criteria
Code:
Criteria criteria = getActorDao().createCriteria();
criteria.add(Restrictions.or(
      Restrictions.ilike("name", "adi"),
      Restrictions.ilike("description", "adi")
      ));
criteria.setProjection(Projections.projectionList()
      .add(Projections.groupProperty("name"), "name")   
      .add(Projections.groupProperty("description"), "description")   
      );
criteria.setResultTransformer(new AliasToBeanResultTransformer(ActorTestDTO.class));
List result = criteria.list();


The generated SQL (show_sql=true):
Code:
select this_.name as y0_, this_.description as y1_
from Actor this_
left outer join Action this_1_ on this_.id=this_1_.id
left outer join Location this_2_ on this_.id=this_2_.id
left outer join UserGroup this_3_ on this_.id=this_3_.id
left outer join WebUser this_4_ on this_.id=this_4_.id
where (lower(y0_) like ? or lower(y1_) like ?)
group by this_.name, this_.description


the Problem
This generated SQL works on HSQLDB but NOT on MS-SqlServer.
The wrong code:
Code:
where (lower(y0_) like ? or lower(y1_) like ?)

The correct code:
Code:
where (lower(this_.name) like ? or lower(this_.description) like ?)

I verified this by issuing the sql directly in SQL-server.

Can anyone verify that his is a bug, or am I missing something?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 27, 2008 7:09 am 
Beginner
Beginner

Joined: Tue Nov 06, 2007 5:13 am
Posts: 28
created bugreport: http://opensource.atlassian.com/project ... e/HHH-3546


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

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.