-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Using Component in order by generates an unexpected token
PostPosted: Thu Oct 09, 2008 8:13 am 
Beginner
Beginner

Joined: Fri Jul 08, 2005 8:55 pm
Posts: 37
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.