[ http://issues.apache.org/jira/browse/OJB-75?page=comments#action_12357526 ]
Jakob Braeuchi commented on OJB-75: ----------------------------------- could you please post the sqls. i expect a prefetching problem here. > orderby attribute in repository_user.xml not always respected > ------------------------------------------------------------- > > Key: OJB-75 > URL: http://issues.apache.org/jira/browse/OJB-75 > Project: OJB > Type: Bug > Components: PB-API > Versions: 1.0.3 > Environment: All > Reporter: Al Lofus > > We have an object mapping defined that contains a collection-descriptor. That > collection-descriptor uses an orderby attribute and an indirection table, as > follows: > <class-descriptor class="com.dchoc.common.entity.LeagueEntity" > table="LEAGUES"> > <field-descriptor id="1" name="id" column="ID" jdbc-type="INTEGER" > primarykey="true" autoincrement="true"/> > <field-descriptor id="2" name="name" column="NAME" jdbc-type="VARCHAR"/> > <collection-descriptor > name="members" > auto-retrieve="true" > auto-update="object" > auto-delete="object" > proxy="true" > indirection-table="LEAGUE_MEMBERS" > orderby="leagueSequence" > element-class-ref="com.dchoc.common.entity.LeagueAccountEntity"> > <fk-pointing-to-this-class column="LEAGUE_ID"/> > <fk-pointing-to-element-class column="LEAGUE_ACCOUNT_ID"/> > </collection-descriptor> > </class-descriptor> > We were having problems where sometimes the objects returned in the members > collection were ordered by the leagueSequence, and sometimes they weren't. > From our testing, we determined that the objects in the members collection > were ordered by leagueSequence when the LeagueEntity objects were obtained > via a call to PersistenceBroker.getObjectByQuery(Query). When the > LeagueEntity objects were obtained via a call to > PersistenceBroker.getCollectionByQuery(Query), the objects in the members > collection were *not* ordered by leagueSequence (they were ordered by a > default order of ID/primary key). We turned on the SQL generation for OJB and > verified that in the former case, the SQL select statement includes an order > by clause, and in the latter case, it does not. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
