Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.2.5.ga</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.3.0.ga</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.3.1.ga</version>
</dependency>
Mapping documents:
JPA
Code between sessionFactory.openSession() and session.close():
Spring handled
Full stack trace of any exception that occurs:
Name and version of the database you are using:
mysql 5.5
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
Hi I have following structure:
A Cat has Kittens(collection) and Kitten has fleas(collection) :)
A flea has a property called bloodType.
Now I only want cats that has kittens with fleas that has bloodType a. How do I do this?
I tried this:
Criteria criteria = getHibernateSession().createCriteria(Cat.class);
criteria = criteria.setFetchMode("kittens", FetchMode.SELECT)
.setFetchMode("fleas", FetchMode.SELECT).add(
Restrictions.in("bloodType", searchParameters
.getbloodTypes()));
But I get this error:
org.hibernate.QueryException: could not resolve property: bloodType of: cat