-->
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: Criteria Example query with projection
PostPosted: Thu Sep 21, 2006 10:13 pm 
Newbie

Joined: Fri Feb 17, 2006 5:45 pm
Posts: 6
Hello,
I am trying to use criteria query using example and trying to resolve this since last few days. I need to use projection with the example query to get only certain properties - I am trying following, but it is not working.

User usr = new User();
usr.setCity = 'TEST';
getCurrentSession().createCriteria(User.class)
.setProjection( Projections.distinct( Projections.projectionList()
.add( Projections.property("name"), "name")
.add( Projections.property("city"), "city")))
.add( Example.create(usr))

The generated sql keeps having a where class refering to just y0_= ? instead of this_.city.

So, I was wondering is criteria query with example supported for projection? how can I have only certain properties queried using example query?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 16, 2008 2:02 pm 
Newbie

Joined: Tue Jan 29, 2008 1:30 pm
Posts: 9
Hi,

I am also having this problem. It seems that Hibernate can't support this. Is there a workaround, is this a known bug or should we file a bug instead? I couldn't find this problem on the hibernate jira site.


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.