When I use this code to read a single object from the database:Code:
Criteria crit = sessionFactory.getCurrentSession().createCriteria(entityName);
crit.add(Restrictions.idEq(id));
Object ret = crit.uniqueResult();
sessionFactory.getCurrentSession().clear();
It results in the following SQL-statements:Code:
select count(*) as y0_ from <TABLE_NAME> this_ where this_.ID='id1'
select * from ( select this_.ID as PK1_235_0_, this_.ATTR1...... from <TABLE_NAME> this_ where this_.ID='id1' order by this_.ID asc ) where rownum <= 100
Can anyone tell me why
- the first statement (select count(*)...) is generated by hibernate and
- the second statement includes "where rownum <= 100" - since only one object is read ???
I'm using Hibernate 3.3.1 GA with Mappings (no Annotations) and an Oracle 10 database.