You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Sebastien Cesbron <se...@laposte.net> on 2003/08/05 13:51:42 UTC

QueryByMtoNCriteria

While investigating on how to solve my problem I found the 
QueryByMtoNCriteria class.
I don't know if it could solve my problem but I wonder if there is any 
example somewhere (I found nothing in the doc and in the distrib examples) ?

Thanx

Seb



Jim Moore wrote:
> I guess I don't understand the question: That's a very basic 1:n
> relationship, exactly what OJB does easily, with a clear "path."
> 
> http://db.apache.org/ojb/tutorial3.html#mapping%201:n%20associations
> 
> So you XML would look like
> 
> <class-descriptor class="User" table="USER">
>   <field-descriptor
>     name="userId"
>     column="ID"
>     jdbc-type="INTEGER"
>     primarykey="true" />
>   <field-descriptor
>     name="groupName"
>     column="KategorieName"
>     jdbc-type="VARCHAR" />
>   <field-descriptor
>     name="description"
>     column="Beschreibung"
>     jdbc-type="VARCHAR" />
>   <collection-descriptor
>     name="emailsSent"
>     element-class-ref="Email">
>     <inverse-foreignkey field-ref="senderId"/>
>   </collection-descriptor>
>   <collection-descriptor
>     name="emailsReceived"
>     element-class-ref="Email">
>     <inverse-foreignkey field-ref="receiverId"/>
>   </collection-descriptor>
> </class-descriptor>
> 
> <class-descriptor class="User" table="EMAIL">
>   <field-descriptor
>     name="emailId"
>     column="ID"
>     jdbc-type="INTEGER"
>     primarykey="true" />
>   <field-descriptor
>     name="sendId"
>     column="SENDER_ID"
>     jdbc-type="INTEGER" />
>   <field-descriptor
>     name="receiverId"
>     column="RECEIVER_ID"
>     jdbc-type="INTEGER" />
>   <reference-descriptor
>     name="sender" class-ref="User">
>     <foreignkey field-ref="senderId"/>
>   </reference-descriptor>
>   <reference-descriptor
>     name="receiver" class-ref="User">
>     <foreignkey field-ref="receiverId"/>
>   </reference-descriptor>
> </class-descriptor>
> 
> 
> -----Original Message-----
> From: Sebastien Cesbron [mailto:sebastien.cesbron@laposte.net] 
> Sent: Friday, August 01, 2003 1:30 PM
> To: OJB Users List
> Subject: Re: Query a non navigable path
> 
> 
> The connexion is that my email have one sender and one receiver. For this
> example, the database looks like
> 
> create table EMAIL
> (
>    ID          integer not null,
>    SENDER_ID   integer not null,
>    RECEIVER_ID integer not null,
>    primary key (ID),
>    foreign key (SENDER_ID)   references USER(ID),
>    foreign key (RECEIVER_ID) references USER(ID)
> );
> 
> create table USER
> (
>    ID integer not null,
>    primary key (ID)
> );
> 
> Seb
> 
> PS : Sorry if there is syntax erros, I can't cut and paste my sql
> 
> Jim Moore wrote:
> 
>>Do you have anything that would connect them?  What does your database 
>>definition look like for those tables?
>>
>>
>>-----Original Message-----
>>From: Sebastien Cesbron [mailto:sebastien.cesbron@laposte.net]
>>Sent: Friday, August 01, 2003 1:07 PM
>>To: ojb-user@db.apache.org
>>Subject: Query a non navigable path
>>
>>
>>Hi,
>>
>>I'am always on the way of integrating ojb in my project. It works very
>>well but I am in front of a problem I can't solve.
>>I have for example this classes :
>>Class Email
>>{
>>private User sender;
>>private User receiver;
>>}
>>Class User
>>{
>>// No link to the * emails I sent or received
>>}
>>
>>I am using the PB-API an I want to retrieve a liste of all users that
>>were receivers of email I sents. How can I do that ?
>>As queries are based on path expressions and I don't have path from 
>>receiver I don't know how to do such a query
>>
>>Thanks in advance for any help
>>
>>Seb
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: QueryByMtoNCriteria

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi sebastien,

QueryByMtoNCriteria  is used internally.

hth
jakob

Sebastien Cesbron wrote:

> While investigating on how to solve my problem I found the 
> QueryByMtoNCriteria class.
> I don't know if it could solve my problem but I wonder if there is any 
> example somewhere (I found nothing in the doc and in the distrib 
> examples) ?
>
> Thanx
>
> Seb
>
>
>
> Jim Moore wrote:
>
>> I guess I don't understand the question: That's a very basic 1:n
>> relationship, exactly what OJB does easily, with a clear "path."
>>
>> http://db.apache.org/ojb/tutorial3.html#mapping%201:n%20associations
>>
>> So you XML would look like
>>
>> <class-descriptor class="User" table="USER">
>>   <field-descriptor
>>     name="userId"
>>     column="ID"
>>     jdbc-type="INTEGER"
>>     primarykey="true" />
>>   <field-descriptor
>>     name="groupName"
>>     column="KategorieName"
>>     jdbc-type="VARCHAR" />
>>   <field-descriptor
>>     name="description"
>>     column="Beschreibung"
>>     jdbc-type="VARCHAR" />
>>   <collection-descriptor
>>     name="emailsSent"
>>     element-class-ref="Email">
>>     <inverse-foreignkey field-ref="senderId"/>
>>   </collection-descriptor>
>>   <collection-descriptor
>>     name="emailsReceived"
>>     element-class-ref="Email">
>>     <inverse-foreignkey field-ref="receiverId"/>
>>   </collection-descriptor>
>> </class-descriptor>
>>
>> <class-descriptor class="User" table="EMAIL">
>>   <field-descriptor
>>     name="emailId"
>>     column="ID"
>>     jdbc-type="INTEGER"
>>     primarykey="true" />
>>   <field-descriptor
>>     name="sendId"
>>     column="SENDER_ID"
>>     jdbc-type="INTEGER" />
>>   <field-descriptor
>>     name="receiverId"
>>     column="RECEIVER_ID"
>>     jdbc-type="INTEGER" />
>>   <reference-descriptor
>>     name="sender" class-ref="User">
>>     <foreignkey field-ref="senderId"/>
>>   </reference-descriptor>
>>   <reference-descriptor
>>     name="receiver" class-ref="User">
>>     <foreignkey field-ref="receiverId"/>
>>   </reference-descriptor>
>> </class-descriptor>
>>
>>
>> -----Original Message-----
>> From: Sebastien Cesbron [mailto:sebastien.cesbron@laposte.net] Sent: 
>> Friday, August 01, 2003 1:30 PM
>> To: OJB Users List
>> Subject: Re: Query a non navigable path
>>
>>
>> The connexion is that my email have one sender and one receiver. For 
>> this
>> example, the database looks like
>>
>> create table EMAIL
>> (
>>    ID          integer not null,
>>    SENDER_ID   integer not null,
>>    RECEIVER_ID integer not null,
>>    primary key (ID),
>>    foreign key (SENDER_ID)   references USER(ID),
>>    foreign key (RECEIVER_ID) references USER(ID)
>> );
>>
>> create table USER
>> (
>>    ID integer not null,
>>    primary key (ID)
>> );
>>
>> Seb
>>
>> PS : Sorry if there is syntax erros, I can't cut and paste my sql
>>
>> Jim Moore wrote:
>>
>>> Do you have anything that would connect them?  What does your 
>>> database definition look like for those tables?
>>>
>>>
>>> -----Original Message-----
>>> From: Sebastien Cesbron [mailto:sebastien.cesbron@laposte.net]
>>> Sent: Friday, August 01, 2003 1:07 PM
>>> To: ojb-user@db.apache.org
>>> Subject: Query a non navigable path
>>>
>>>
>>> Hi,
>>>
>>> I'am always on the way of integrating ojb in my project. It works very
>>> well but I am in front of a problem I can't solve.
>>> I have for example this classes :
>>> Class Email
>>> {
>>> private User sender;
>>> private User receiver;
>>> }
>>> Class User
>>> {
>>> // No link to the * emails I sent or received
>>> }
>>>
>>> I am using the PB-API an I want to retrieve a liste of all users that
>>> were receivers of email I sents. How can I do that ?
>>> As queries are based on path expressions and I don't have path from 
>>> receiver I don't know how to do such a query
>>>
>>> Thanks in advance for any help
>>>
>>> Seb
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org