Hi
On migration from Hibernate 2 to 3 I have a few problems while using the SQLQuery for bitwise operations. I have included the sql query I pass, and also the code for execution and retrieval. This worked in version 2 but does not in 3.2. I first want to chek that the query code (not the SQL statement) is correct, before looking for other reasons. All the mapping code is created using XDoclet, and worked before and appears to work now for everything else.
Any help would be greatly appreciated
Hibernate version: 3.2
The SQL (show_sql=true):
select o.* from order_header as o where (o.status & 1) = 1 and (o.status & 2) = 0 and (o.status & 32) = 0 and (o.status & 16) = 0 and (o.status & 1024) = 0 and (o.status & 64) = 0 and (o.status & 4096) = 0 and (o.status & 2048) = 0
Code between sessionFactory.openSession() and session.close():
List result = session.createSQLQuery(sql).addEntity("o", Order.class).list();
for (Iterator it = result.iterator(); it.hasNext();) {
Object[] row = (Object[]) it.next();
orders.add((Order) row[0]);
}
Full stack trace of any exception that occurs:
WARN 2006-12-05 12:56:24,173 JDBCExceptionReporter - SQL Error: 0, SQLState: S0022
ERROR 2006-12-05 12:56:24,173 JDBCExceptionReporter - Column 'id0_' not found.
ERROR 2006-12-05 12:56:24,175 OrderManager - problems finding orders
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:1420)
at org.hibernate.loader.Loader.list(Loader.java:1400)
at org.hibernate.loader.CustomLoader.list(CustomLoader.java:101)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1353) at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:146)
at com.glide3.domain.core.order.OrderManager.findAllOrders(OrderManager.java:116)
Name and version of the database you are using:
MySql 4.2
|