• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate: Column not found. org.hibernate.exception.GenericJDBCException

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am stuck with this since a very long time. I am getting this error for an HQL or a native sql query in hibernate. I

request you to help me. I am unable to find the post where this has been discussed before. Kindly help!


Error


Code


xml files



 
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Most of the things seem right...
Is the User table is already present in your database or are you trying to create it using Hibernate.

I have a suggestion...change the table name in your hbm and the database to a name other than 'USER'..
to
<class name="User" table="USER_LOGIN">
or something like that..and make sure the table name in your DB is USER_LOGIN(or something else, but not USER)

I vaguely remember that sometime back, i was getting some weird error by using Hibernate with MySQL while trying to name the table name as USER....and hibernate complained...and changing the table name did the trick...
It sounds silly, but is true..(as far as i remember)

 
Natalie Ap
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rahul,

Thanks for the quick response.

Tell you what..This code worked fine till Thurs. On Friday, I was tinkering around a bit trying to learn how to enable the Hibernate caching and connection pooling. After that, this weird error started appearing for ALL queries in my code.. So I changed my hibernate config file to what it was before. The DB was not touched, not was the code. But this error ha been coming and I cannot figure out what to do about it.


Any clues anyone? Please help!

Thanks,
Natalie




Rahul Babbar wrote:Hi,

Most of the things seem right...
Is the User table is already present in your database or are you trying to create it using Hibernate.

I have a suggestion...change the table name in your hbm and the database to a name other than 'USER'..
to
<class name="User" table="USER_LOGIN">
or something like that..and make sure the table name in your DB is USER_LOGIN(or something else, but not USER)

I vaguely remember that sometime back, i was getting some weird error by using Hibernate with MySQL while trying to name the table name as USER....and hibernate complained...and changing the table name did the trick...
It sounds silly, but is true..(as far as i remember)

 
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try to print out the actual SQL hibernate generates (put in the options like hibernate.show_sql=true, etc.) and see what exactly is getting translated into col_0_0.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well i have been facing the same issue.
the query works fine if i do not use aliases. but if i use them i keep getting JDBC exceptions
Jan 31, 2011 3:05:10 PM org.hibernate.type.NullableType nullSafeGet
INFO: could not read column value from result set: id; Column 'id' not found.
Jan 31, 2011 3:05:10 PM org.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 0, SQLState: S0022
Jan 31, 2011 3:05:10 PM org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: Column 'id' not found.

This is the query:

HIbernate: SELECT Reports.id reportId,Reports.studyId As 'studyId',Reports.name As 'Name',Reports.type As 'Periodicity',Users.name As 'Created By',Reports.status As 'Status' FROM Studies INNER JOIN Reports ON Reports.studyId=Studies.id INNER JOIN Users ON Users.id=Reports.createdBy WHERE (Studies.id = 127) AND (Reports.templateId IS NULL) AND (Reports.isDeleted = false)

when i copy and paste it in my SQL Browser, i get results.

I would be greatful if someone could shed some light
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic