Hi,
I am trying to test one query with HQL but I am getting Unexpected token error message. I am using Hibernate 3.1 & oracle 10g. Here is my query.
Code:
public void testLoad() throws HibernateException{
String sql =
"select ds.applicationName"
+ "from DetailsStatus ds where ds.identity"
+ " between :startOrder and :endOrder";
org.hibernate.Session s = null;
try {
s = DetailsStatusDAO.createSession(null);
org.hibernate.Query query = s.createQuery(sql);
query.setString("startOrder","302001000");
query.setString("endOrder","302001003");
System.out.println(query.list());
} catch (HibernateException e) {
}
}
The actual error message from console is:
22:52:40,171-org.hibernate.hql.ast.ErrorCounter.reportError():33-ERROR--->line 1:31: unexpected token: DetailsStatus
22:52:40,171-org.hibernate.hql.ast.HqlParser.processEqualityExpression():195-WARN --->processEqualityExpression() : No expression
to process!
And here is my Hibernate mapping file contents:
Code:
<hibernate-mapping package="com.iusa.statusmanager"
default-lazy="false">
<class name="DetailsStatus" table="DETAILS_STATUS">
<id name="id" column="ID" type="int">
<generator class="sequence">
<param name="sequence">STATUS_DETAILS</param>
</generator>
</id>
<property name="applicationName" column="APPLICATION_NAME"
type="java.lang.String" not-null="true" />
<property name="statusCode" column="STATUS_CODE" type="int" not-null="true" />
<property name="identity" column="IDENTITY"
type="java.lang.String" />
</hibernate-mapping>
Can anybody help me?
thanks.