-->
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.  [ 3 posts ] 
Author Message
 Post subject: Problem when retrieving data after a request
PostPosted: Tue Jul 22, 2008 10:44 am 
Newbie

Joined: Thu Apr 24, 2008 10:50 am
Posts: 3
Hello !
I have a little problem when i try to retrieve data after a request, using NHibernate.
I create the request with ICreteria and i add some projections only on specific case.

I execute the request :
Quote:
Dim oResult As IList(Of Array) = oCriteria.List(Of Array)()

Then I can only retrive data with oResult(0).GetValue(0), and as the projections are never the same, the value of the index (for GetValue) is always changing.

How can I associate an alias to a column and use it to retrieve its value ?
How can I do something like that : oResult(« column ») ?

Thanks for your help.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 22, 2008 12:59 pm 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Is this what you are looking for ?

Code:
criteria.SetProjection(Projections.XYZ, "alias");

or

criteria.SetProjection(Projections.ProjectionList()
   .Add(Projections.XYZ, "alias"));

_________________
--Wolfgang


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 24, 2008 11:20 am 
Newbie

Joined: Thu Apr 24, 2008 10:50 am
Posts: 3
Not really, I already know that.

I want to be able to use "alias" outside the Criteria. I mean when I have retrieved the data from the database, and use "alias" as an index on the resulting array, and not just an integer.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.