> > > I have fetched a record set from database.but now I want to only one > record . > so I code : >
This is a Hibernate API question. You aren't actually performing the query until you call list(), scroll(), iterate() or uniqueResult() http://www.hibernate.org/hib_docs/v3/api/org/hibernate/Query.html In this case it sounds like you want uniqueResult() (Company)_session.createQuery("from Company where id='11'").uniqueResult(); Josh On 10/11/07, MavenMan <[EMAIL PROTECTED]> wrote: > > > I have fetched a record set from database.but now I want to only one > record . > so I code : > > //page class > import com.myspacce.domain.Company; > public Company getCom() > { > _session=_sessionmanager.getSession(); > return (Company)_session.createQuery("from Company where > id='11'"); > } > > //HTML page: > ${com.name} > the error is: > org.hibernate.impl.QueryImpl cannot be cast to com.myspacce.domain.Company > > I want to kown how to do ? > please help me . > thanks!! > from Chinese > > -- > View this message in context: > http://www.nabble.com/how-to-fetch-only-one-record---tf4605478.html#a13150571 > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- -- TheDailyTube.com. Sign up and get the best new videos on the internet delivered fresh to your inbox.