File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Column Watch "Column New topic
Author

Column 'id0_' not found Error

Rj Vasanth kumar
Greenhorn

Joined: Aug 30, 2009
Posts: 5
When i execute the hibernate code for retrieving the data getting exception.
DB: MySQL5

org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:92)
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:80)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:1502)
at org.hibernate.loader.Loader.list(Loader.java:1482)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:103)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1333)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:146)
at test.Example.main(Example.java:20)
Caused by: java.sql.SQLException: Column 'id0_' not found.
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1056)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927)
at com.mysql.jdbc.ResultSetImpl.findColumn(ResultSetImpl.java:1060)
at com.mysql.jdbc.ResultSetImpl.getInt(ResultSetImpl.java:2694)
at org.hibernate.type.IntegerType.get(IntegerType.java:26)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:77)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:68)
at org.hibernate.loader.Loader.getKeyFromResultSet(Loader.java:650)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:277)
at org.hibernate.loader.Loader.doQuery(Loader.java:384)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:203)
at org.hibernate.loader.Loader.doList(Loader.java:1499)
... 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


Vasanth

SCJP 5.0
David Newton
Author
Rancher

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Column 'id0_' not found Error
 
Similar Threads
Problem with named queries
Error in named native query (Invalid Column Name)
Hibernate: Column not found. org.hibernate.exception.GenericJDBCException
Executing stored procedures in hibernate
Queries and "column not found" error