-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate Criteria query
PostPosted: Tue Dec 13, 2011 4:59 pm 
Newbie

Joined: Tue Dec 13, 2011 4:50 pm
Posts: 6
I have a Book table
Book_primary_key | book_id | book type
1 1 fiction
2 1 tech
3 2 basic
4 1 alien

If book _id has 100 of id's with '1' and and only 30 books of book_id '2'
Can I write a Hibernate criteria query to limit id's 1 and 2 to 20 each i.e. twenty rows containing book_id '1'
and twenty rows with book_id '2'

Criteria criteria = (Criteria) session.createCriteria(Book.class);
criteria.addOrder(Order.asc("bookId"));
.
.
.
return criteria.list();
Thanks !


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.