Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.2.0 GA
Dear All,
I have a strange problem with a simple HQL Query using a unidirectional component, the solution must be obvious...
Code:
<hibernate-mapping >
<class name="PriceAffecter" table="priceaffecter">
<id name="id" column="ID" type="integer">
<generator class="native" />
</id>
<version name="version" unsaved-value="negative" />
.....
.....
<property name="createdDateTime" column="CREATEDDATETIME" type="org.joda.time.contrib.hibernate.PersistentDateTime" not-null="true" />
<component name="lastAction" class="Action" unique="true">
<property name="action" column="LASTACTION" />
<property name="update" column="LASTUPDATETIME" type="org.joda.time.contrib.hibernate.PersistentDateTime" />
<property name="updateBy" column="LASTUPDATEDBY" />
<property name="updateBusinessDate" column="LASTACTIONBUSDATE" type="org.joda.time.contrib.hibernate.PersistentLocalDate" />
</component>
</class>
</hibernate-mapping>
My HQL is:
Code:
from PriceAffecter as pa
order by pa.id, pa.lastAction.update
I get an 'unexpected token' exception which seems to relate to the fact that the pa.lastAction.update has one more "."
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: . near line 1
The following HQL works fine:
Code:
from PriceAffecter as pa
order by pa.id, pa.createdDateTime
How could I order by my update timestamp?
How could I access a component member in a Component for an order by clause?
Many thanks
Benoit