Hi Thomas and Danilo,

What Thomas is proposing works fine.
But be careful with the result.
If the cardinality is as following:
Addressen 1:n Adressen_adressart_typ 1:n Adressartandtyp 1:n
Then you can have several instances of the same Adress.
You will have to make the "distinct" manually.
Be also aware that ojb will do its best to create the joins.
You can ensure (force) the outer joins with query.setPathOuterJoin("<ref To
Adressen_adressart_typ>.<ref To Adressartandtyp>")
for example.

David WIESZTAL.


-----Original Message-----
From: Danilo Tommasina [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 15, 2004 5:16 PM
To: OJB Users List
Subject: Re: join with ojb



Ok, then try something like this:

Criteria crit = new Criteria();
crit.addEqualTo( "<ref To Adressen_adressart_typ>.<ref To
Adressartandtyp>.addressart", new Integer( 1 ) );

QueryByCriteria query = new QueryByCriteria( Adressen.class, crit, true );

PersistenceBroker pb = null;
try {
   pb = PersistenceBrokerFactory.defaultPersistenceBroker();

   Collection results = pb.getCollectionByQuery( query );

   // The Collection now contains instances of class Adressen

} catch ( Exception e ) {
   // Do exception handling
} finally {
   if ( pb != null ) {
      pb.close();
   }
}


> Danilo Tommasina wrote:
> 
> Thanks a lot for your help.
> 
>> With the PersistenceBroker API you can use a ReportQueryByCriteria
> 
> O.K., but we want as result a collection with 'Address' objects. The 
> 'name' attribute is an exampel only. Sorry, my question was not clear 
> enough. We don't know the right mapping and how to build the 'Criteria' 
> object.
> 
> regards
> 
> Thomas
> 


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