File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Column 'id0_' not found      Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Column Watch "Column New topic

Column 'id0_' not found Error

Rj Vasanth kumar

Joined: Aug 30, 2009
Posts: 5
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


SCJP 5.0
David Newton

Joined: Sep 29, 2008
Posts: 12617

Without knowing anything about your mapping or class, it looks like there's a mismatch between the mapping, class, or DB table.
I agree. Here's the link:
subject: Column 'id0_' not found Error
It's not a secret anymore!