-->
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: Order by element of Collection
PostPosted: Wed Aug 25, 2004 12:45 pm 
Beginner
Beginner

Joined: Tue Mar 23, 2004 8:40 pm
Posts: 22
I got the Oracle error with the following HQL:
Code:
select
  elements(vo.descriptions) 
from
  CompanyVO vo
order by
  elements(vo.descriptions)


Any ideas? Thanks in advance!

P.S. Problem is table alias "descriptio1_" instead of "descriptio2_" is used in order by clause.

Martin

Hibernate version:
2.1.6

Mapping documents:
Code:
    <map name="descriptions"
      table="COMPANY_DESCR"
      lazy="false"
      cascade="all"
      >
      <key column="COMPANYOBJID"/>
      <index column="LOCALEINFOOBJID" type="string"/>
      <element column="DESCRIPTION" type="string"/>
    </map>


Full stack trace of any exception that occurs:
net.sf.hibernate.JDBCException: Could not execute query java.sql.SQLException: ORA-00904: invalid column name

Name and version of the database you are using:
Oracle 8.1.7

Generated SQl:
Code:
SELECT
  descriptio2_.description as x0_0_
FROM
  company companyvo0_,
  company_descr descriptio2_
WHERE
  companyvo0_.objId = descriptio2_.companyobjid
ORDER BY 
  descriptio1_.description


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 26, 2004 11:30 am 
Beginner
Beginner

Joined: Tue Mar 23, 2004 8:40 pm
Posts: 22
That's my only workaround right now, any comments?

HQL
Code:
select
  elements(vo.descriptions) 
from
  CompanyVO vo,
  vo.descriptions vo_descriptions
order by
  vo_descriptions


Generated SQL
Code:
SELECT
  descriptio2_.DESCRIPTION as x0_0_
FROM
  COMPANY companyvo0_,
  COMPANY_DESCR descriptio1_,
  COMPANY_DESCR descriptio2_
WHERE
  companyvo0_.objId=descriptio1_.COMPANYOBJID and
  companyvo0_.objId=descriptio2_.COMPANYOBJID
order by 
  descriptio1_.DESCRIPTION


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.