Not sure which DB you are using, but for example I've noticed that HSQL seems to not parse the entire statement string upfront which can lead to issue like this. It leaves parsing certain pieces relative to its internal working datasets; if there are no results in those working sets, you get no errors. Specifically I have seen this with correlated sub-queries.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Max Rydahl Andersen Sent: Friday, January 28, 2005 9:56 AM To: Hibernate development Subject: [Hibernate] Criteria curiosity... Hi, while working on Critiera i "bumped" into this funny behavior: Doing the following Critieria on an empty db gives no error: s.createCriteria(Student.class) .add( Expression.like("name", "Gavin", MatchMode.START) ) .addOrder( Order.asc("name") ) .createCriteria("enrolments", "e") .addOrder( Order.desc("year") ) .addOrder( Order.desc("semester") ) .createCriteria("course") .addOrder( Order.asc("description") ) .setProjection( Expression.projection() .add( Expression.property("this.name") ) .add( Expression.property("e.year") ) .add( Expression.property("e.semester") ) .add( Expression.property("courseCode") ) .add( Expression.property("description") ) ) .uniqueResult(); but when data is available i get an error saying that courseCode is not available on Student - which is totally correct. (using explicit criteria aliases solves it) I'm just wondering why this is not discovered when the query gives no result - it should still be able to tell that courseCode is not on Student - is this expected behavior ? -- Max Rydahl Andersen callto://max.rydahl.andersen Hibernate [EMAIL PROTECTED] http://hibernate.org JBoss Inc [EMAIL PROTECTED] http://jboss.com ------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ hibernate-devel mailing list hibernate-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/hibernate-devel ------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ hibernate-devel mailing list hibernate-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/hibernate-devel