2 Replies Latest reply on Jan 28, 2005 9:19 AM by iwadasn

    automatic left-join

    iwadasn Newbie

      Some of the JDO providers (such as KODO) provide a feature that auto-left joins wherever possible. This would be very nice for JBoss to have. Basically, here's what I'm looking for.

      A switch should allow Jboss to auto-left join along each CMR relationship provided that the following two conditions are true....

      1) This is a single element relationship, we won't be pulling back a set.
      2) This relationship references a class that hasn not yet been referenced (so there are no loops).

      Given that these two conditions are met, the resulting group of left joins wouldn't return any more rows than other wise, and it could eliminate the need for a lot of database trips.

      Is there any global option that can enable this sort of thing?

      In addition, slightly unrelated, I have this for my defaults....


      java:/DataWarehouseDS
      <datasource-mapping>Oracle9i</datasource-mapping>
      <create-table>true</create-table>
      <remove-table>false</remove-table>
      <read-only>false</read-only>
      <row-locking>false</row-locking>
      <pk-constraint>true</pk-constraint>
      <fk-constraint>false</fk-constraint>
      <preferred-relation-mapping>foreign-key</preferred-relation-mapping>
      <read-ahead>
      on-find
      <page-size>1000</page-size>
      <eager-load-group>*</eager-load-group>
      <!--deep-read-ahead /-->
      </read-ahead>


      The problem is that the read-ahead isn't appearing to work. We grab all the data on-find, like this.....

      SELECT t0_o.id, t0_o.name, t0_o.indx FROM risk_reader.ETF_VIEW t0_o

      This code is executed once, so far so good.

      Then when I loop through the etfs to grab their data, I get a sql statement per ETF, like this...

      SELECT name, indx FROM risk_reader.ETF_VIEW WHERE (id=?)

      This shouldn't happen, as I just fetched this data with the on-find query, right? This is using COmmit option A, so this should be in the cache already.


      Thanks







        • 1. Re: automatic left-join
          Alexey Loubyansky Master

          You could add feature request but I don't think I will work on it in the near future (maybe someone else could contribute it).
          The only left join fetching JBossCMP supports is by using left-join read-ahead. See wiki.

          • 2. Re: automatic left-join
            iwadasn Newbie

            Why would this not be high priority? Turning on the global flag in our JDO provider almost exactly doubles the speed, I think the same would happen in JBoss. It seems like such a huge gain for so little effort, why would you not put this in?

            Granted, we could run through the whole app to turn on left joins all over the place, but that would take serious effort, especially as left join syntax isn't supported by XDoclet. Our project is huge, and it's hard to sell people on CMP over JDO when the CMP system requires massive adjustment to turn on what should be (and is in JDO) a global pref.