0 Replies Latest reply on May 13, 2004 3:00 AM by aquila125

    Relationship Lazy Loading in jboss3.2.3 does not give expect

    aquila125

      Hi,


      I've got 2 tables: Price and Product, each product has some prices:
      Price table:
      * rowid
      * price
      * product
      * date
      Product table:
      *rowid
      *allproductinfo


      Now I would like to fetch all prices and the corresponding products on a certain date.
      So I create an eager-load-group in my price entity tag to load all data instead of just the rowid.
      This works well,

      But then I also need the info that's stored in the product, so JBoss starts to run a query for each price I loaded. I looked at the documentation I bought and found the chapter on Relationships lazy loading, so I added these linese to my jbosscmp-jdbc.xml:


      <ejb-relation>
       <ejb-relation-name>ProductEJB - PriceEJB</ejb-relation-name>
       <ejb-relationship-role>
       <ejb-relationship-role-name>product</ejb-relationship-role-name>
       <key-fields>
       <key-field>
       <field-name>row_id</field-name>
       <column-name>product</column-name>
       </key-field>
       </key-fields>
       </ejb-relationship-role>
       <ejb-relationship-role>
       <ejb-relationship-role-name>price</ejb-relationship-role-name>
       <key-fields/>
       <read-ahead>
       <strategy>on-find</strategy>
       <page-size>4</page-size>
       <eager-load-group>allColumns</eager-load-group>
       </read-ahead>
       </ejb-relationship-role>
      </ejb-relation>
      


      But performing these changes, changes nothing in the queries that JBoss is running.
      Any pointers?
      (is there a way to load all of the data of price and corresponding product in 1 query? something like JOIN in sql)

      thanks