From: Gavin K. <ga...@ap...> - 2002-09-19 14:52:06
|
Yeah, I have been trying to think of a ways to let you refer to the index of a collection element from inside the query language but I havn't really come up with anything. However, in this particular case, I'm not sure why you are using a query at all. List elements are returned sorted by index already; simply load the List itself.... I'm assuming you have another where condition that you aren't displaying to us. Unfortunately the new collection filtering functionality doesn't help either, because its also not aware of collections indexes. What might be possible would be to allow a special "index" identifier in collection filters, the same way we allow "this" to refer to the element. That would solve your problem, wouldn't it? ----- Original Message ----- From: Christoph Sturm To: hib...@li... Sent: Thursday, September 19, 2002 11:54 PM Subject: [Hibernate] how to get the name of the matchtable Hi All! I have 2 tables that have a n:m relation through a matchtable. table1 contains a definition like this: <list role="categories" table="tema_x_vtrm" lazy="true"> <key column="vtrmid"/> <index column="srtpos"/> <many-to-many class="at.mcg.clubticket.db.Tema" column="temaid"/> </list> and I'd like my elements to be sorted by srtpos. so I have to write select table from vtrm in class Table, cat in table.categories.elements where cat.id = 2 order by cat0_.srtpos, because hibernate joins the matchtable as "cat0_". Now I dont like this, because its an implementation detail that could change. I often think that I dont understand all parts of the query language, so maybe there's an easy solution to this, and someone can enlighten me ;) regards chris |