I have two entities: item, and bid, each item have many bids for it, so bid is a collection property of item.
in the page that show an item, I just want to show the firs
For plain SQL, do the following:
Select B.*
From item I, bid B,
Where T.itemId = B.itemId
Limit 10;
Same can be done in case you are using hibernate, using criteria API or HQL HQL example:
Query query = session.createQuery("from MyTable");
query.setMaxResults(10);
Criteria example:
session.createCriteria(Abc.class)
.addOrder(Order.desc("id"))
.setMaxResults(10)
.list();