Hi,
    I am using ojb1.0_rc5, ODMG api with OJB queries, mysql4 (innodb tables)
in Linux Red Hat 7.3 (kernel 2.4.20-20.7).
    How can I run a query that returns objects from a different class than
the class to search from? For example:

        class Person{
            int id;
            String name;

            //rest of the class ommited
        }

        class House{
            int id;
            String name;

            int ownerId;
            Person owner; //reference to Person

            //rest of the class ommited
        }

        The House class has a reference to the Person class.

        I want to build a query like this:
          Criteria c=new Criteria();
          c.addEqualTo("name","home");
          QueryByCriteria query=QueryFactory.newQuery(House.class,c);

          I want the query to return objects of the Person class using the
reference from House (owner atribute).
          Something like:
              query.setSelectAttribute("owner",true); //the true parameter
is to return distinct objects
                or
              broker.getCollectionByQuery(query,"owner",true);

          I looked for a similar method in OJB api and docs and couldn't
find one. Is there such a similar method or is there anyway I can achieve
the same result?

    I know that I can get House objects from the query and then get the
Person objects I need in a loop, but that would make performance suffer in
my scenario.
    Please, notice that I don't have a collection of Houses in Person
because that would also make performace suffer in my scenario.

    Any help would be appreciated.

Thanks,
    Jair Jr



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to