aspose 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
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
 
Consider Paul's rocket mass heater.
 
subject: hibernate not retrieving data from database