hi kristen,

ojb does the join automatically:

query.create("select authors ...Autor where books.title like ?");

this sample need a relationship-definition named 'books' and an attribute 'title' in class Books. the relationship 'books' is a bidirectional m:n relationship based on the table writtenBy.

jakob

kristen schrieb:

Hello !

First, sorry for my english...

I would like to create a request which are based on a m:n relationships.

For example :

a book can be written by several authors and several authors can write books.


This is the relation :

book <-> writtenBy <-> author

For example, How can I obtain the name of all the author who have written the book "my book" ?

I have the following code but I don't know how can I put several classes after the "from" :

Transaction tx = odmg.newTransaction();
tx.begin();
OQLQuery query = odmg.newOQLQuery();
String queryStr = "select auhors from " + Author.class.getName()+ .... ?

query.create(queryStr);
GroupsList = (List) query.execute();
tx.commit();


Thank you for your help


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