-->
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: criteria - select a specify column list
PostPosted: Thu Nov 17, 2005 8:42 am 
Newbie

Joined: Thu Nov 17, 2005 8:36 am
Posts: 1
Location: Poland
Hi - help

Anyone knows if it possile to select column list using Criteria? And if it is please give me an example


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 18, 2005 2:52 am 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
Hi

Try this out !!!
If the values in the column are static then u can do it this way or Load the values from the DataBase and put it in a a List and do it

ArrayList countryList = new ArrayList();
countryList.add("Switzerland");
countryList.add("Germany");
countryList.add("France");
Criteria critetria= session.createCriteria(Adress.class);
critetria.add(Expression.in("Country",countryList));
List <Adress>list = critetria.list();
for (Adress adress : list) {
// iterate through
}

_________________
RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.


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.