Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
3.2.0.cr4
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.hibernate.oracle.Payment" table="PAYMENT_REQUEST">
<id name="id" column="PAYMENT_REQUEST_EID" type="long">
<generator class="increment"/>
</id>
<property name="orderId" type="string" column="ORDER_ID"/>
<property name="orderDate" type="timestamp" column="ORDER_DATE"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Session session = sf.openSession();
Transaction tx = session.beginTransaction();
try {
tx = session.beginTransaction();
Criteria criteria = session.createCriteria(Payment.class);
criteria.add(Expression.sql("to_char(order_date) = '27-OCT-06'"));
List list = criteria.list();
Full stack trace of any exception that occurs:
Name and version of the database you are using:
Oracle9i
The generated SQL (show_sql=true):
select this_.PAYMENT_REQUEST_EID as PAYMENT1_0_, this_.ORDER_ID as ORDER2_0_0_, this_.ORDER_DATE as ORDER3_0_0_ from PAYMENT_REQUEST this_ where to_char(order_date) = '27-OCT-06'
Debug level Hibernate log excerpt:
Problems with Session and transaction handling?
Read this:
http://hibernate.org/42.html
This query returns no results but I am sure it should return two rows because I run the generate SQL.
Please help!
Rob