-->
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.  [ 2 posts ] 
Author Message
 Post subject: query.setParameter on order by
PostPosted: Fri Mar 19, 2004 6:08 am 
Newbie

Joined: Fri Mar 12, 2004 11:04 am
Posts: 10
Hibernate 2.1.1

Hi all,

This is the mapping :

<hibernate-mapping>
<class name="be.asp.pktr.bean.UserrightsBEAN" table="pktr_userrights">

<composite-id>
<key-property name="acco_id" column="acco_id" type="integer"/>
<key-property name="user_id" column="user_id" type="integer"/>
<key-property name="appl_id" column="appl_id" type="integer"/>
</composite-id>

<property name="userr_actif" column="userr_actif" type="integer" />
<property name="userr_authorized" column="userr_authorized" type="integer" />
<property name="userr_admin" column="userr_admin" type="integer" />
<property name="userr_creationTMS" column="userr_creationTMS"/>

<many-to-one name="account" class="be.asp.pktr.bean.AccountBEAN" column="acco_id" insert="false" update="false" />
<many-to-one name="user" class="be.asp.pktr.bean.UserBEAN" column="user_id" insert="false" update="false" />
<many-to-one name="application" class="be.asp.pktr.bean.ApplicationBEAN" column="appl_id" insert="false" update="false" />

</class>
</hibernate-mapping>


This one works :
query = session.createQuery(
"select a from UserrightsBEAN as a " +
"left join a.user b " +
"left join a.account c " +
"left join a.application d " +
"where (a.acco_id = :p1) " +
"order by b.user_login ");
query.setParameter("p1", acco_id);

This one doesn't works :

query = session.createQuery(
"select a from UserrightsBEAN as a " +
"left join a.user b " +
"left join a.account c " +
"left join a.application d " +
"where (a.acco_id = :p1) " +
"order by :p2 ");
query.setParameter("p1", acco_id);
query.setParameter("p2", order);

with String order := "b.user_login"

No error , but also not ordered


any idea or any other solution ???


Tnx in advance!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 19, 2004 6:11 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
order by :p2
cannot bind parameter for order clause, i think it's not possible to do


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

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.