I am using Hiberante 2.1.1 with Oracle and the following SQL dialect
net.sf.hibernate.dialect.OracleDialect
Here's my Java:
Code:
String query = "SELECT cle.observed_time as {cle.observedTime} FROM ul_common_log_event {cle}";
public List find(String query) {
Session session = null;
List result = null;
try {
session = sessionFactory.openSession();
String[] aliasArray = {"cle"};
Class[] classArray = {CommonLogEvent.class};
Query q = session.createSQLQuery(query, aliasArray, classArray);
result = q.list();
} catch (HibernateException ex) {
ex.printStackTrace();
}
finally {
close(session);
}
return result;
}
This Java String is translated to:
Code:
Hibernate: SELECT cle.observed_time as observed2_0_ FROM ul_common_log_event cle
which produces the following error:
Code:
Caused by: java.sql.SQLException: Invalid column name
Here's part of the table definition:
Code:
CREATE TABLE UL_COMMON_LOG_EVENT
(
CLE_ID NUMBER(19) NOT NULL,
OBSERVED_TIME DATE,
Interestingly enough, when I run the Hibernate produced SQL in TOAD, it works just fine.
Has anyone had this issue before? I am sure that I am missing something.