Based on looking in
org.apache.ojb.broker.accesslayer.sql.SqlSelectStatement.getStatement()
-- it looks like if no columns are specified, then it will do the
multimapped object select, which you are seeing.

It is clearer as what to do in the HEAD version, but in RC5, it looks
like if you change it over to a ReportQuery, and ask for only that one
column that you need, it would work.


                if (columns == null || columns.length == 0)
            {
                /**
                 * MBAIRD: use the appendListofColumnsForSelect, as it
finds
                 * the union of select items for all object mapped to
the same table. This
                 * will allow us to load objects with unique mapping
fields that are mapped
                 * to the same table.
                 */
                columnList =
appendListOfColumnsForSelect(getSearchClassDescriptor(), stmt);
            }
            else
            {
                columnList = appendListOfColumns(columns, stmt);
            }


In this case, columns are ones that are specified, which ReportQuery is
used for.

-Andrew



-----Original Message-----
From: Glenn Barnard [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 20, 2004 2:10 PM
To: [EMAIL PROTECTED]
Subject: How to use DUAL table for multiple types of queries


I posted this yesterday....Would someone PLEASE help me. Am running out
of time.


We use Oracle 9 and have several different functions we can call. In
OJB, they are all mapped with the table name of DUAL. For example:

       SELECT function(args) AS column FROM DUAL

Our repository.xml has a table entry for each function so that the
result is kept in it's own class. For example:

  <class-descriptor
        class="com.business.model.ClassName1"
        table="dual"
        refresh="true"  >

    <field-descriptor id="1"
      name="fieldName1"
      column="fieldName1"
      primarykey="true"
      jdbc-type="VARCHAR"
      nullable="false" />

    </class-descriptor>

and:

  <class-descriptor
        class="com.business.model.ClassName2"
        table="dual"
        refresh="true"  >

    <field-descriptor id="1"
      name="fieldName2"
      column="fieldName2"
      primarykey="true"
      jdbc-type="VARCHAR"
      nullable="false" />

    </class-descriptor>

The problem is that when OJB goes to extract the values from the
result set, it tries to do so for 2 columns, fieldName1 and
fieldName2.

I thought that by specifiying the class name I wanted (e.g., Class1)
that OJB would only get the fields for that class. Can anyone advise
me how I can do this without resorting to having only one class for
a function calls? Oh, I'm using a customized rc5 and cannot upgrade
until after this release ships (a timing/resource issue).

Thanks ya'll!

_________________________________________________________________
Stop worrying about overloading your inbox - get MSN Hotmail Extra
Storage! 
http://join.msn.click-url.com/go/onm00200362ave/direct/01/


---------------------------------------------------------------------
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]

Reply via email to