Just wanted to spread the word on this so others won't be as surprised as I was. I assumed that 3.1 was a drop in replacement for 3.0.x, but there are issues, such as those listed in the migration guide:
http://www.hibernate.org/250.html. Many of my HQL queries used apparently "invalid" syntax that managed to run successfully due to leniency in the HQL parser. The Hibernate reference PDF for 3.0.5
seemed to indicate that such syntax was OK, and indeed did run fine. After reading this migration guide page, though, I reviewed the PDF again, and saw that it didn't
explicitly say that you could write: "from Entity e where e.collection.property". Apparently, though, implicit joins via
single-point associations are valid.
It would be helpful if the reference documentation could be updated to make this point more explicit. Thanks again to the Hibernate team for their hard work!
Cheers!
Ari
Here's the key point:
Query language changes
Stricter checking of invalid queries
Hibernate 3.1 has stricter checking for invalid queries, some of which actually worked purely by side effect in earlier versions. For example, Hibernate never supported "from Entity e where e.collection.property" but needs an explicit join for collection elements "from Entity e join e.collection c where c.property". Furthermore, a query that specifies join fetching, but the owner of the fetched association was not present in the select list throws an exception now: "select b from A join fetch a.bees b" - this query makes no sense, remove the "fetch".