How are you using Hibernate3 with Spring? Have they already added support for Hibernate3?
In Hibernate3, that delete method (the ability to delete entities based on the result of a query) has been deprecated. All these deprecated Session methods have been moved to the org.hibernate.classic.Session interface. Now org.hibernate.Session does still have a delete(Object) method, but it is obviously intended for deletion of a single entity. So when you call session.select("my query), Hibernate thinks you are trying to delete the string "my query".
The reason we deprecated delete(String query)? Because once it is better defined, we will be adding support for EJB3-style bulk delete operations, which is a better way to do this.
In the meantime, if you need this functionality, just do what Session.delete(String query) did itself internally:
1) perform the query, getting the list of matching entities;
2) iterate the list, calling session.delete(entity) for each entity in the list.
|