Hi,

What you are doing is using inner joins with legacy Oracle or Sybase syntax 
(and probably several other DBs).

With the PersistenceBroker API you can use a ReportQueryByCriteria

something like this:

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

ReportQueryByCriteria query = new ReportQueryByCriteria( Adressen.class, new String [] { 
"name" }, crit, true );

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

  Iterator results = pb.getReportQueryIteratorByQuery( query );

  // Extract the value you need before closing the PersistenceBroker
  // The Iterator entries are Object [] containing a single String representing 
the name
  // String name = (String) ((Object []) results.next())[ 0 ];


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

Modify the addEqualTo( ... ) statement according to your repository.xml, 
without this file i cannot help more.

bye
Danilo


Hallo there,

I want to do this with ojb but I can't find a good and straight forward way.

SELECT DISTINCT A.name
FROM adressen A, adressen_adressart_typ B, adressartandtyp C
WHERE A.adressen_id = B.adressen_id
AND B.adressart_id = C.adressart_id
AND C.adressart = 1;

Could anyone give me a simple solution?

Thanks in advance.

regards

Thomas




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



Reply via email to