This week's book giveaways are in the Cloud and AI/ML forums.
We're giving away four copies each of Cloud Native Patterns and Natural Language Processing and have the authors on-line!
See this thread and this one for details.
Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!
  • 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 ...
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Column 'id0_' not found Error

Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When i execute the hibernate code for retrieving the data getting exception.

org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(
at org.hibernate.exception.ErrorCodeConverter.convert(
at org.hibernate.exception.JDBCExceptionHelper.convert(
at org.hibernate.loader.Loader.doList(
at org.hibernate.loader.Loader.list(
at org.hibernate.loader.custom.CustomLoader.list(
at org.hibernate.impl.SessionImpl.listCustomQuery(
at org.hibernate.impl.SQLQueryImpl.list(
at test.Example.main(
Caused by: java.sql.SQLException: Column 'id0_' not found.
at com.mysql.jdbc.SQLError.createSQLException(
at com.mysql.jdbc.SQLError.createSQLException(
at com.mysql.jdbc.SQLError.createSQLException(
at com.mysql.jdbc.ResultSetImpl.findColumn(
at com.mysql.jdbc.ResultSetImpl.getInt(
at org.hibernate.type.IntegerType.get(
at org.hibernate.type.NullableType.nullSafeGet(
at org.hibernate.type.NullableType.nullSafeGet(
at org.hibernate.loader.Loader.getKeyFromResultSet(
at org.hibernate.loader.Loader.getRowFromResultSet(
at org.hibernate.loader.Loader.doQuery(
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(
at org.hibernate.loader.Loader.doList(
... 5 more
00:58:12,406 WARN Configurator:126 - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/G:/Hibernate/hibernate/hibernate/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
Hibernate: select name from hiber as h
00:58:13,062 WARN JDBCExceptionReporter:57 - SQL Error: 0, SQLState: S0022
00:58:13,062 ERROR JDBCExceptionReporter:58 - Column 'id0_' not found.

Java Source :

List list =session.createSQLQuery("select name from hiber as h").addEntity("h", Hiber.class).list();
Iterator itr = list.iterator();

Kindly provide the solution for this
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Without knowing anything about your mapping or class, it looks like there's a mismatch between the mapping, class, or DB table.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!