I use Hibernate 3.3.2 GA with MySQL 5.1. I try to use session.createSQLquery(string SQL).list(), but can't get right answer back. I find the problem may be caused of db table schema. We have a db table named stock_info includes CODE and PRICE two fileds and contains 100 records inside. For example {(1001, 10.8), (1002, 2.5), (1003, 4.7), ... }. SQL script is "SELECT CODE, PRICE FROM STOCK_INFO". There is no problem I run it using JDBC directly. If I use session.createSQLquery(string SQL).list(), I always get result {(1, 10.8), (1, 2.5), (1, 4.7), ..} back. The values of CODE is replaced by Hibernate, but others not. Is the word "CODE" reserved in Hibernate? I try many different tables have filed named CODE, and all of them got same error. Can anybody help? Thank for you kindly reply in advance.
|