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: I need help with Projection
PostPosted: Tue Oct 03, 2006 7:53 am 
Newbie

Joined: Tue Jul 25, 2006 2:50 am
Posts: 11
Hibernate version:
1.2.0


Hellow Forum, excuse-me for my English. I have a problem with projection.
I don´f know how can I use this utility to select 1 field of a entity.
Any know any examples??
I don´t know where i can find a good documentation.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 03, 2006 9:28 am 
Senior
Senior

Joined: Mon Aug 21, 2006 9:18 am
Posts: 179
If you downloaded the source, you can look in the Unit Tests for some examples of Projections usage.
Here is a snippet that gets the count for the FirstName property on a Person that equals "Mark":
Code:
            ICriteria criteria = Session.CreateCriteria(typeof (Person));
            criteria.Projection = Projections.Count("FirstName");
            criteria.Add(Expression.Eq("FirstName", "Mark"));



You can also chain projections together using
Projections.ProjectionList().Add(Projections.Count(<propertyName>).Add(...)

_________________
If this helped...please remember to rate it!


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.