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