I am a new user and playing Hibernate 2.1.8. Everything seems OK except I got a strange returned query results. In order to get my first Hibernate code worked, I use a simple query statement something like Criteria crt = HibernateUtil.getSession().createCriteria(
Message.class);
crt.add(Expression.between("postedDate", start, end));
crt.add(Expression.eq("author", author));
crt.addOrder(Order.asc("postedDate"));
Collection c = crt.list();
logger.debug("# of records:" + c.size());
When I run my code, I did get results and the logger reports correct size. But the interesting thing is all records are identical (to the first one) if I display them. Then I use the Hibernate generated sql statement to manually run ang got results as expected.
My database is Oracle 9i.
Any comments? Thanks very much for your help.
Yongping
|