-->
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: Simple select statement
PostPosted: Tue Oct 31, 2006 4:17 pm 
Newbie

Joined: Tue Oct 31, 2006 4:07 pm
Posts: 1
I am new to my company and they use nHibernate. I have never used it before, and the person who knew it, left.

They use a lot of queries like below, which I understand, but seem quite inefficient in their implementation:

Dim Criteria As ICriteria = m_session.CreateCriteria(GetType(TableName))

Criteria.Add(Expression.Eq("Company", CompanyID))
CompanyThings = Criteria.List


How would I do something simple like the equivalent to "Select ID from Tablename" to only return a list of ID's rather than all possible related data? There are many partial snippets in the .chm files in c#, but they don't seem to be a complete example, nor am I familiar with c#.


Thanks, any help is greatly appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 31, 2006 4:42 pm 
Beginner
Beginner

Joined: Fri Oct 20, 2006 8:02 am
Posts: 36
Your HQL must be like it:
"select T.CompanyID from TableName T "


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.