Mantis - Resin
Viewing Issue Advanced Details
276 minor always 06-20-05 00:00 11-30-05 14:42
user241  
 
urgent  
closed 3.0.13  
3.0.13 fixed  
none    
none 3.0.15  
0000276: order-by clause ignored in many-to-many ejb-relations
RSN-311
This works in resin 2.x. but does not work in resin 3. The order-by clause in the 1st relation below is ignored when i call topic.getNewsItemsByCMR. The sql generated is "SELECT caucho1.storyid, caucho1.url, caucho1.headline, caucho1.source, caucho1.timestamp FROM storytopic caucho0, story caucho1 WHERE (caucho0.storyid = caucho1.storyid) AND (caucho0.topic = ?))" ... there is no order by newsId desc

Note that order-by clauses *are* correctly utilized in many-to-one calls, such as the 2nd relation below. In this case the sql generated is "SELECT c.intradeid, c.day, c.price, c.name, c.relation, c.shares, c.symbolid, c.toprice, c.tradetype FROM intrade c WHERE (c.symbolid = ?) ORDER BY c.day DESC"

  <ejb-relation>
    <ejb-relation-name>storytopic</ejb-relation-name>
    <ejb-relationship-role>
      <multiplicity>Many</multiplicity>
      <relationship-role-source>
        <ejb-name>topics</ejb-name>
      </relationship-role-source>
      <cmr-field>
        <cmr-field-name>newsItemsByCMR</cmr-field-name>
        <sql-column>topic</sql-column>
      </cmr-field>
      <order-by>newsId desc</order-by>
    </ejb-relationship-role>
    <ejb-relationship-role>
      <multiplicity>Many</multiplicity>
      <relationship-role-source>
         <ejb-name>newsItems</ejb-name>
      </relationship-role-source>
      <cmr-field>
        <cmr-field-name>topics</cmr-field-name>
        <sql-column>storyid</sql-column>
      </cmr-field>
    </ejb-relationship-role>
  </ejb-relation>

   <ejb-relation>
    <ejb-relationship-role>
      <relationship-role-source>
        <ejb-name>symbols</ejb-name>
      </relationship-role-source>
      <cmr-field>
        <cmr-field-name>insiderActivity</cmr-field-name>
      </cmr-field>
      <multiplicity>One</multiplicity>
      <order-by>date desc</order-by>
    </ejb-relationship-role>
    <ejb-relationship-role>
      <relationship-role-source>
        <ejb-name>insideractivity</ejb-name>
      </relationship-role-source>
      <cmr-field>
        <cmr-field-name>symbol</cmr-field-name>
        <sql-column>symbolid</sql-column>
      </cmr-field>
      <multiplicity>Many</multiplicity>
    </ejb-relationship-role>
  </ejb-relation>
3.0.13 pro. all platforms

Notes
(0000310)
ferg   
06-20-05 00:00   
ejb/069l, ejb/069m