-->
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: Any way to refer to "IndexColumns" in HQL?
PostPosted: Sat Jul 08, 2006 12:34 am 
Beginner
Beginner

Joined: Thu Oct 16, 2003 7:25 pm
Posts: 38
Location: New York City
I have a ManyToMany "List" association with an IndexColumn on both sides. I'd like to order the results of an ad hoc HQL via this index column, but I cannot seem to refer to it without errors. Is there a way to refer to the list index column in HQL?

For instance, in my Issue.java code:

Code:
...
@NamedQuery(name = "ContentByPublication", query =
  "select cu from com.xxx.webpub.cms.model.Issue issue join issue.contentUsages cu"
  + " where issue.publication.id = :publicationId order by %%%%%")
...
  @ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
  @JoinTable(catalog = "cms", name = "IssueContentUsage",
      joinColumns = { @JoinColumn(name = "issueId") },
      inverseJoinColumns = { @JoinColumn(name = "contentUsageId") })
  @IndexColumn(name = "sequence", base = 1)
  @LazyCollection(LazyCollectionOption.FALSE)
  @Fetch(FetchMode.JOIN)
  public List<ContentUsage> getContentUsages() { return _contentUsages; }
  public void setContentUsages(List<ContentUsage> arg) { _contentUsages = arg; }
  private List<ContentUsage> _contentUsages = null;
...


Now, I'd like to have the percent signs be the "sequence" of the contentUsages list, but no permutation of HQL will work. Is there one? If there is no way to do it, please let me know that too. Thanks.

Tom


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 10, 2006 2:34 am 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
It should already be that way, ordered correctly. There are several functions to do with lists and indicies (see the ref docs section 14.9), and of course you can refer to a particular element via "issue.publication[4]" or whatever.

_________________
Code tags are your friend. Know them and use them.


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.