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
you can use criteria's setFirstResult() and setMaxResult(). or this post would be helpful for your question
example:
sessionFactory.getCurrentSession().createQuery("your query here").setFirstResult(0).setMaxResult(10);
this will generate 10 rows of data from database
you have use annotation driven. simply add the annotation Size to your bid object
@OneToMany( mappedBy = "object", cascade = CascadeType.ALL)
@Size(min=1, max=10)
private Set bid;