• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Joe Ess
  • salvin francis

Getting All Records in Hibernate

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using MySQL. For some reason, I can't get all records from a 2 tables in Hibernate.

I have tried this:


And this is not working. I am sure that my POJO and Mapping file are good since I was able to query on the same table but with "Restrictions". So this is working:


But this is NOT working:

[ June 17, 2007: Message edited by: Jazzy Jaz ]
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Jazzy Jaz",
Welcome to the JavaRanch.

We're a friendly group, but we do require members to have valid display names.

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with invalid display names get deleted, often without warning

thanks,
Dave
 
Jazzy Sanchez
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im sorry. Made the correction.

Can anybody help me with the problem above?

Thank you in advance!
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure I understand your problem. You want to read all of the records for a table?

When you describe 'working' and 'not working', what do you mean?
 
ranger
Posts: 17344
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And just out of curiosity, you have

Query q = session.createQuery("from ReviewTO");

So you are creating a Query object, but where are you running that query. I am assuming that you called execute or list methods to get the resultset.

Mark
 
Jazzy Sanchez
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I want to get all the records in a table. Code below is not returning any results but instead an error.



I mean by not working is, it spit out some errors like this:

org.hibernate.exception.GenericJDBCException: could not execute query

Thanks again!

[ June 17, 2007: Message edited by: Jazzy Sanchez ]
[ June 17, 2007: Message edited by: Jazzy Sanchez ]
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jazzy, could you post your entire trace... Is Hibernate generating a valid query You can run in another place.

Thanks
 
Jazzy Sanchez
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's the error:

Exception in thread "main" java.lang.NullPointerException
at st.wais.to.Test.getAllReviews(Test.java:30)
at st.wais.to.Test.main(Test.java:17)ReviewDAO: org.hibernate.exception.GenericJDBCException: could not execute query

Thanks for the help!
 
Jazzy Sanchez
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Solved! It is a data integrity problem. The data being parse is not the type that's expected.

Thanks anyway!
 
If somebody says you look familiar, tell them you are in porn. Or in these tiny ads:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!