File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes hibernate not retrieving data from database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "hibernate not retrieving data from database" Watch "hibernate not retrieving data from database" New topic
Author

hibernate not retrieving data from database

meghna koneru
Greenhorn

Joined: Jul 27, 2011
Posts: 2
I am new to java or hibernate...

Trying to get data from database...it does not pick up the data...

Authentication.java


Gatekeeper.java


Domain.java




Main.Class





It gives null values even though the User table has data
meghna koneru
Greenhorn

Joined: Jul 27, 2011
Posts: 2
Please someone respond....I wonder if it is the issue with the query "select distinct domainName from User"....Is this the way to write query in hibernate?
Arun Kumarr
Ranch Hand

Joined: May 16, 2005
Posts: 513

You might want to do two things.
1. Post if you are getting any exceptions.
2. Turn-on hibernate.show_sql=true in the configuration document and see what query it is running.
This will show you the SQL query which hibernate uses to fetch data.


If you are not laughing at yourself, then you just didn't get the joke.
Waswani Naresh
Ranch Hand

Joined: May 01, 2008
Posts: 66
Hi Mehgna,

Wrap your query execution code with in a transaction and it should work.

session.getTransaction().begin(); and session.getTransaction().commit();

Regards,
Naresh Waswani


Naresh Waswani
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: hibernate not retrieving data from database
 
Similar Threads
DropDown that triggers a postback
proble in converting ArrayList<String> to ArrayList<Object>
help me in this JSP checkbox code
Maintain checked checkbox status
Equivalent of logic iterate in Struts 2