I have strange situation, with hibernate I am generating native/sql query for getting data from dinamic table, tables are generated from code so I have not entities for each table, I find tables by prefix. So generated query working well when I run it in mysql console, but with hibernate when I try to fetch data and map it to one general entity I am always have exception about missing column.
SQLQuery query1 = getSession().createSQLQuery(sqlLinked.toString());
List<MyGlobalEntity> objectList = (List<MyGlobalEntity>) query1
.addEntity(MyGlobalEntity.class).list();
Hibernate complained like
org.hibernate.exception.SQLGrammarException: could not execute query
Caused by: java.sql.SQLException: Column 'col name' not found.
But global entity have all fields which have generated entities. And SQL worked wee from console.
Who can suggest something?
here is a query , short version
select * from g_table where id > 0 AND x_5 >='2001-12-31'
Thanks.