-->
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.  [ 4 posts ] 
Author Message
 Post subject: Corect use of detached criteria in allias
PostPosted: Sun Oct 05, 2008 5:58 am 
Newbie

Joined: Sat May 31, 2008 9:09 am
Posts: 5
Hi I encountered a problem whilst using the 'DetachedCriteria' class. In my scenarion i have a users table, a user rights allocation table and a rights table. Basically what i do is select a right and assign that right to the user, that`s working fine.


My problem is when i want to query a user with rights A,B & C for example. I approached this problem as follows:

Code:
           

  'user rights
   userSearchCriteria.CreateAlias("rights", "rts")
   userSearchCriteria.SetFetchMode("rights", NHibernate.FetchMode.Eager)

            For Each listItem As ListItem In chkBoxRightsList.Items
                userSearchCriteria.Add(Restrictions.Eq("rts.right.name", listItem.text))
            Next


When i run the above code i get "{"could not resolve property: right.name".

I am assuming this is something related to incorrect use of alias creation, and in order to confirm that i created a simple code snippet where i query all user rights and that allowed me to access the right.name property, so class mappings appears to be fine.

Any help would be greatly appreciated

thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 05, 2008 8:03 am 
Beginner
Beginner

Joined: Mon Apr 02, 2007 8:08 am
Posts: 24
I'm almost sure you should put "rts.name" instead of "rts.right.name" at your restriction.

_________________
--
<a href="http://ideasse.blogspot.com/">Ideas + Software Engineering</a> (English)
<a href="http://iiso.blogspot.com/">Ideas + IngenierĂ­a del Software</a> (Spanish)


Last edited by juanignaciosl on Sun Oct 05, 2008 1:46 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 05, 2008 1:44 pm 
Newbie

Joined: Sat May 31, 2008 9:09 am
Posts: 5
Hi ,

thanks for the help but the posted code is a copy and paste from the actual code


Top
 Profile  
 
 Post subject: hibernate alias creation
PostPosted: Mon Oct 06, 2008 2:09 am 
Newbie

Joined: Sat May 31, 2008 9:09 am
Posts: 5
Hi Guys,

I found a tutorial for this problem : http://devlicio.us/blogs/billy_mccaffer ... alias.aspx. You might find it handy


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