473,395 Members | 1,468 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to retrieve data from the database in Hibernate

Hi all

Am just started learning hibernate. i tried all insert, update and delete except select. Some body help me in retrieve data from the database table. There are methods like save,update,delete in session object, whatsover for select?
Aug 1 '11 #1
4 3459
There are two methods: get and load. Use one of them. Or use HQL in method query.
Aug 1 '11 #2
Thanks for giving response to my post, but if possible can you explain the same with a small Example
Aug 2 '11 #3
If you want to get many records from YoutTable do something like this:
Expand|Select|Wrap|Line Numbers
  1. List<YourTable> list = (List<YourTable>)session.createQuery("from YourTable").list();
and if you want to get only one record by id do:
Expand|Select|Wrap|Line Numbers
  1. YourTable oneItem = (YourTable) session.get(YourTable.class, id);
Aug 2 '11 #4
Thank you very much....
Aug 3 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Miki | last post by:
Hi. I have a IIS server with php3 installed. I have SQL server database and data stored in unicode format (nvarchar fields). In header of my php I have the meta: <meta HTTP-EQUIV="content-type"...
4
by: Claudia Fong | last post by:
Hi, I have a form where I need to display the data of a department that stores in a access db. When I first load the form it will call a function name loaddata which will get the first...
1
by: funcSter | last post by:
I want to retrieve data from an Excel file like how I would with a database. I understand that I would have to use OLE DB. Somehow I think I cannot get the connection string right, as the bit of...
5
by: ggk517 | last post by:
We are trying to develop an Engineering application using PHP, Javascript with Informix as the back-end. Is it possible to retrieve data using Javascript but by accessing the Database. Say...
1
by: RajithaV | last post by:
Hi, I am developing a web application using ASP.Net I am using sql server.My coding is in VB.net I want to know how to move data from excel file into the Database. I also need to know how to...
1
by: sonalpathak | last post by:
hi i m working on windows application using c#. i have to retrieve data from database in checkbox control but its giving the following error---cannot convert object to bool. the code i am typing...
1
by: Amita Singh | last post by:
Hi, How to retrieve data from database in data table?
5
by: fruityfreak | last post by:
I would like to know how to I retrieve information from another database table... Instead of keying in manually, I would like to retrieve data directly from the logged in user row. For the user...
12
lifeisgreat20009
by: lifeisgreat20009 | last post by:
I am a newbie to Struts and JSP...I have been working on the code below for 5 hours now..I googled a lot but couldn't get much help so finally I am here.. Hoping of getting my problem solved. Please...
0
by: michaelTun | last post by:
how can I retrieve data from oracle database to Visual Studio -2005 asp.net grid view. connection.Open() string sql = "select * from departments where department_id < 60" cmd = new...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.