Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate doesn't seem to allow nested properties in an Order object.
Hibernate version:
3.0.5
Mapping documents:
<album.hbm.xml>
<hibernate-mapping package="ami.server.dto">
<class name="AlbumDTO" table="calliope.albums">
<id name="id" column="id">
<generator class="native"/>
</id>
<property name="title" column="title" not-null="true"/>
<property name="upc" column="upc" not-null="true"/>
<many-to-one name="artist" column="artist_id" class="ArtistDTO" fetch="join"/>
</class>
</hibernate-mapping>
<artist.hbm.xml>
<hibernate-mapping package="ami.server.dto">
<class name="ArtistDTO" table="calliope.artists">
<id name="id" column="id">
<generator class="native"/>
</id>
<property name="name" column="name" not-null="true"/>
<property name="searchName" column="search_name" not-null="false"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Criteria criteria = s.createCriteria(AlbumDTO.class);
criteria.add(Example.create(obj));
criteria.addOrder(Order.asc("artist.name"));
Full stack trace of any exception that occurs:
No stack trace... just the following exception:
org.hibernate.QueryException: could not resolve property: artist.name of: ami.server.dto.AlbumDTO
Name and version of the database you are using:
MySQL 5.0.4 BETA
The generated SQL (show_sql=true):
No SQL is Generated
Debug level Hibernate log excerpt:
Nothing is really logged either... just the following line:
org.hibernate.QueryException: could not resolve property: artist.name of: ami.server.dto.AlbumDTO