-->
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: CreateCriteria question
PostPosted: Mon Mar 31, 2008 3:08 pm 
Regular
Regular

Joined: Tue Oct 16, 2007 9:45 am
Posts: 93
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

1.2.1

Hi, Is there a generice version of CreateCriteria?

I am trying to create generic repository and I need method like this

Code:
        public EntityBag<T> FindByCriteria<T>( params ICriterion[] criterion) where T : EntityBase
        {
{
           
           ICriteria criteria = NHSession.CreateCriteria(????????);

            foreach (ICriterion criterium in criterion)
            {
                criteria.Add(criterium);
            }
                     
            //TODO : add extension method to criteria EntityBag<T> to criteria
            return new EntityBag<T>( criteria.List<T>());
        }


Last edited by exp2000 on Mon Mar 31, 2008 3:27 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 31, 2008 3:26 pm 
Regular
Regular

Joined: Tue Oct 16, 2007 9:45 am
Posts: 93
Argh, never mind, I can do
ICriteria criteria = NHSession.CreateCriteria( typeof(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.