Uploaded image for project: 'OJB'
  1. OJB
  2. OJB-75

orderby attribute in repository_user.xml not always respected

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.0.3
    • 1.0.x CVS, 1.1 CVS
    • PB-API
    • None
    • All

    Description

      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.

      Attachments

        Activity

          People

            brj Jakob Braeuchi
            allofus@digitalchocolate.com Al Lofus
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: