• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting All Records in Hibernate

 
Jazzy Sanchez
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 ]
 
David O'Meara
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?
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac 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 ]
 
Halcon Guatemala
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic