You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Christian Steinebach <Ch...@marintek.sintef.no> on 2013/01/22 02:10:48 UTC

@ManyToMany?

Hi,

In case:

- A transport service providers serves several routes
- A route may be served by several transport service providers

How can this many to many relationship be modeled in Isis?

In the example application one ToDoItem may only appear in ONE
dependency list.

           Christian

RE: @ManyToMany?

Posted by Christian Steinebach <Ch...@marintek.sintef.no>.
Hi Jeroen!

Thank you very much for your answers, that's what I needed. :-)

         Christian
________________________________________
From: Jeroen van der Wal [jeroen@stromboli.it]
Sent: Tuesday, January 22, 2013 11:53 AM
To: users@isis.apache.org
Subject: Re: @ManyToMany?

Obviously you have to add some code which manages the relationship, see the
isc-mmp and isc-mmc domain object code snippets. [1]

More about various relation types from a JDO perspective can be found on
the Datanucleus site [2], [3], [4], [5]

Cheers,

Jeroen

[1] http://isis.apache.org/getting-started/editor-templates.html
[2] http://www.datanucleus.org/products/datanucleus/jdo/orm/one_to_one.html
[3] http://www.datanucleus.org/products/datanucleus/jdo/orm/one_to_many.html
[4] http://www.datanucleus.org/products/datanucleus/jdo/orm/many_to_one.html
[5]
http://www.datanucleus.org/products/datanucleus/jdo/orm/many_to_many.html



On Tue, Jan 22, 2013 at 11:27 AM, Jeroen van der Wal <je...@stromboli.it>wrote:

> You can Use the M-N relationship:
>
> public class Route
> {
>     ...
>
>     @Persistent
>     @Join(column="ROUTE_ID")
>     @Element(column="PROVIDER_ID")
>     Set<Provider> provider;
>
>
>
> }
>
> public class Provider
> {
>     ...
>
>     @Persistent(mappedBy="providers")
>     Set<Route> routes;
> }
>
>
>
> On Tue, Jan 22, 2013 at 2:10 AM, Christian Steinebach <
> Christian.Steinebach@marintek.sintef.no> wrote:
>
>> Hi,
>>
>> In case:
>>
>> - A transport service providers serves several routes
>> - A route may be served by several transport service providers
>>
>> How can this many to many relationship be modeled in Isis?
>>
>> In the example application one ToDoItem may only appear in ONE
>> dependency list.
>>
>>            Christian
>
>
>

Re: @ManyToMany?

Posted by Jeroen van der Wal <je...@stromboli.it>.
Obviously you have to add some code which manages the relationship, see the
isc-mmp and isc-mmc domain object code snippets. [1]

More about various relation types from a JDO perspective can be found on
the Datanucleus site [2], [3], [4], [5]

Cheers,

Jeroen

[1] http://isis.apache.org/getting-started/editor-templates.html
[2] http://www.datanucleus.org/products/datanucleus/jdo/orm/one_to_one.html
[3] http://www.datanucleus.org/products/datanucleus/jdo/orm/one_to_many.html
[4] http://www.datanucleus.org/products/datanucleus/jdo/orm/many_to_one.html
[5]
http://www.datanucleus.org/products/datanucleus/jdo/orm/many_to_many.html



On Tue, Jan 22, 2013 at 11:27 AM, Jeroen van der Wal <je...@stromboli.it>wrote:

> You can Use the M-N relationship:
>
> public class Route
> {
>     ...
>
>     @Persistent
>     @Join(column="ROUTE_ID")
>     @Element(column="PROVIDER_ID")
>     Set<Provider> provider;
>
>
>
> }
>
> public class Provider
> {
>     ...
>
>     @Persistent(mappedBy="providers")
>     Set<Route> routes;
> }
>
>
>
> On Tue, Jan 22, 2013 at 2:10 AM, Christian Steinebach <
> Christian.Steinebach@marintek.sintef.no> wrote:
>
>> Hi,
>>
>> In case:
>>
>> - A transport service providers serves several routes
>> - A route may be served by several transport service providers
>>
>> How can this many to many relationship be modeled in Isis?
>>
>> In the example application one ToDoItem may only appear in ONE
>> dependency list.
>>
>>            Christian
>
>
>

Re: @ManyToMany?

Posted by Jeroen van der Wal <je...@stromboli.it>.
You can Use the M-N relationship:

public class Route
{
    ...

    @Persistent
    @Join(column="ROUTE_ID")
    @Element(column="PROVIDER_ID")
    Set<Provider> provider;



}

public class Provider
{
    ...

    @Persistent(mappedBy="providers")
    Set<Route> routes;
}



On Tue, Jan 22, 2013 at 2:10 AM, Christian Steinebach <
Christian.Steinebach@marintek.sintef.no> wrote:

> Hi,
>
> In case:
>
> - A transport service providers serves several routes
> - A route may be served by several transport service providers
>
> How can this many to many relationship be modeled in Isis?
>
> In the example application one ToDoItem may only appear in ONE
> dependency list.
>
>            Christian