[ http://jira.andromda.org/browse/HIB-132?page=comments#action_12056 ] Lee Greiner commented on HIB-132: ---------------------------------
I moved the orderByColumns to the B side of the association and have confirmed that the cartridge has reversed the orderByColumns. I also uncovered another problem. The hql statement generated has the order by clause on the link table instead of on the entity. In the log entries below technician is A and site is B and I have performed B.getA(). 22:14:01,296 INFO [STDOUT] Hibernate: select technician0_.SITE_AFFILIATIONS_FK as SITE1_1_, technician0_.TECHNICIANS_FK as TECHNICI2_1_, technician1_.TECHNICIAN_ID as TECHNICIAN1_0_, technician1_.version as version6_0_, technician1_.NAME_FIRST_NAME as NAME3_6_0_, technician1_.NAME_MIDDLE_INITIAL as NAME4_6_0_, technician1_.NAME_LAST_NAME as NAME5_6_0_, technician1_.CONTACT_INFO_PHONE_NUMBER as CONTACT6_6_0_, technician1_.CONTACT_INFO_FAX_NUMBER as CONTACT7_6_0_, technician1_.CONTACT_INFO_EMAIL as CONTACT8_6_0_, technician1_.CONTACT_INFO_PHONE_EXTENSION as CONTACT9_6_0_, technician1_.COMMENTS as COMMENTS6_0_ from SITE_AFFILIATIONS2TECHNICIANS technician0_ inner join TECHNICIAN technician1_ on technician0_.TECHNICIANS_FK=technician1_.TECHNICIAN_ID where technician0_.SITE_AFFILIATIONS_FK=? order by technician0_.name_last_name asc, technician0_.name_first_name asc 22:14:01,406 WARN [JDBCExceptionReporter] SQL Error: 904, SQLState: 42000 22:14:01,406 ERROR [JDBCExceptionReporter] ORA-00904: "TECHNICIAN0_"."NAME_FIRST_NAME": invalid identifier Back to top View user's profile Send private message > orderByColumns on many-to-many association are reversed > ------------------------------------------------------- > > Key: HIB-132 > URL: http://jira.andromda.org/browse/HIB-132 > Project: Hibernate Cartridge > Type: Bug > Versions: 3.1M1 > Reporter: Lee Greiner > Assignee: Carlos Cuenca > Priority: Minor > > I have a many-to-many association between entities A and B. On the A side of > the association I have the orderByColumns set to attributes of A. The B side > of the association does not have orderByColumns set. When I want to perform > B.getA() I want the A's sorted. > The problem: when I attempt to perform A.getB() I get an exception indicating > the orderBy attributes, the ones defined on the A side of the association, > are invalid. The A.hbm.xml file has the orderBy attribute set and the > B.hbm.xml does not have the orderBy attribute set, the reverse of what I > expected. > Modeling one-to-many associations with orderByColumns set works as > anticipated. ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf