Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Hibernate Select Query

800443Jan 12 2009 — edited May 29 2010
Hi,
how you guys select multiple rows from mysql database via hibernate?
I could select but I only able to get one row out of multiple rows.
int id = 1;
Query query = HibernateUtil.getSession().createQuery("select u from UcoopThread u where u.id = :id");
query.setInteger("id", id);
Collection<UcoopThread> q = (Collection<UcoopThread>) query.list();
The above select query should give me several rows but if I pint the collection content then I will only get one row.
I have also tried query.uniqueResult() , and I get the same result, any help?

Thanks for consideration.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 26 2010
Added on Jan 12 2009
16 comments
1,394 views