I think the id was the only way to reference fields in the repository up until about 0.9.7. Now that you can reference by name it does not have much use from the application point of view...
greets, Nils Danilo Tommasina <[EMAIL PROTECTED]> wrote (Tue, 14 Oct 2003 08:51:08 +0200): > Hi, > > The id attribute has nothing to do with the sorting of query results. > It is just the order the columns will appear in the JDBC ResultSet when > getting columns entries by index instead of getting them by name. > Since at OJB-user level you usually do not work with ResultSets I do not > know what is really the scope of this id... > probably somebody else could be of more help than me > > for sorting use addOrderBy( String fieldname, boolean sortAscending ) in > QueryByCriteria > > bye > danilo > > > The field-descriptor element has the following comments in the > > repository.dtd: > > > > <b>The id attribute is optional.</b> If not specified, OJB internally > > sorts field-descriptors according to their order of appearance in the > > repository file. > > If a different sort order is intended the id attribute may be used to > > hold a unique number identifying the decriptors position in the > > sequence of field-descriptors. > > The order of the numbers for the field-descriptors must correspond to > > the order of columns in the mapped table. > > > > I assume the comments refer to the order in which objects are sorted > > once retrieved from the database. Do the comments apply at all for > > ODMG? Applying a simple 'select objects from Some.class' results in > > all the objects being sorted by id. The order of the fields or > > providing id attributes on each field demonstrated no change in sort > > order. > > > > Here's an excerpt of the field decriptors: > > > > Without ids > > > > <field-descriptor name="lastName" column="last_name" > > jdbc-type="VARCHAR"/><field-descriptor name="firstName" > > column="first_name" jdbc-type="VARCHAR"/> > > > > <field-descriptor name="email" column="email" jdbc-type="VARCHAR"/> > > <field-descriptor name="id" column="user_id" jdbc-type="INTEGER" > > primarykey="true" autoincrement="true"/> > > > > With ids > > > > <field-descriptor id="0" name="lastName" column="last_name" > > jdbc-type="VARCHAR"/> > > <field-descriptor id="1" name="firstName" column="first_name" > > jdbc-type="VARCHAR"/> > > <field-descriptor id="2" name="email" column="email" > > jdbc-type="VARCHAR"/><field-descriptor id="3" name="id" > > column="user_id" jdbc-type="INTEGER" primarykey="true" > > autoincrement="true"/> > > > > > > > > > > > > DISCLAIMER: The information contained in this e-mail is, unless > > otherwise indicated, confidential and is intended solely for the use > > of the named addressee. Access, copying or re-use of the e-mail or any > > information contained therein by any other person is not authorized. > > If you are not the intended recipient please notify us immediately by > > returning the e-mail to the originator. > > > > > -- > Danilo Tommasina, Dipl. Ing. FH Telecom > Software Engineer > RCS Riskmanagement Concepts Systems AG > Technoparkstrasse 1 > CH-8005 Zuerich > T: +41 1 445 29 08 > [EMAIL PROTECTED] > www.risksys.com > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
