The following 2 sections of code are returning a different number of results, which appears to be a Hibernate bug. Is there any reason (odd config, etc) that this might not be a bug?
Option 1
Code:
Criteria crit = session.createCriteria(treeDefClass);
List<?> results = crit.list();
Option 2Code:
Query q = session.createQuery("from " + treeDefClass.getSimpleName() + " as def");
List<?> results = q.list();
The first option returns 400 copies of the same object (same in the sense of the Java = operator, meaning same identity, not just object equality). The second option returns the correct result, 1 object.
Any ideas?
In case it matters...
I'm using Hibernate 3.2.1 GA and Annotations 3.2.1 GA on a Windows XP SP 2 host running a MySQL 5.0.27 DB.