-->
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: How to: Criteria on IDictionary?
PostPosted: Wed Nov 05, 2008 6:26 pm 
Newbie

Joined: Wed Nov 05, 2008 6:18 pm
Posts: 1
Hi all

How can I make a criteria that search in an IDictionary?

I have an object Result

Code:
public class Result
    {
        private int id;

        public virtual int Id
        {
            get { return id; }
            set { id = value; }
        }

        /// <summary>
        /// A mapping of runners -> timespans of their individual time usage
        /// </summary>
        private IDictionary<Runner, TimeSpan> _individualTimeSpent;

        public virtual IDictionary<Runner, TimeSpan> IndividualTimeSpent
        {
            get { return _individualTimeSpent; }
            set { _individualTimeSpent = value; }
        }
    }


And this mapping file
Code:
<class name="Result" table="Result">
   
    <!-- Id -->
    <id name="Id">
      <column name="Id" sql-type="int"/>
      <generator class="increment" />
    </id>

    <map name="IndividualTimeSpent">
      <key column="ResultId" />
      <index-many-to-many
        column="KeyId"
        class="Project.Model.Runner, Project" />
      <element column="ValueTimeSpent" type="TimeSpan"/>
    </map>
   
  </class>


I would like to make a criteria where I search in the map. I cannot do something like this:

Code:
ICriteria criteria = GetCriteria();
criteria = criteria.Add(Expression.Eq("IndividualTimeSpent.Runner.Firstname", name));


But i'm not able to. How can I use criteria on IDictionarys?

Thanks for your time,

kind regards
Jacob


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 07, 2008 5:37 am 
Newbie

Joined: Fri Nov 07, 2008 5:28 am
Posts: 2
Hello, Jacob

If someone could help you I would appreciate it too, because our team is searching a solution of this case.

May be you know how to query IDictinary type property in HQL? We need it very much in our project.

Thanks in advance


Ali


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.