Hi, Yann!

        Your relation description is incorrect. "campaign-has-mediaplan" role
source's multiplicity must be one and "mediaplan_belongsto_campaign"
source's multiplicity must be many. Because one campaign has many media
plans. Try it. Hope it helps.

With best wishes,
Simon Salykov.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Yann Doussot
Sent: Wednesday, August 30, 2000 11:41 AM
To: Orion-Interest
Subject: RE: EJB 2.0 status.


On Mon, 28 Aug 2000, Simon Salykov wrote:

        Here is the description of my test. I want to create 2 entity
beans Campaign and MediaPlan. The relationship is one to many (a campaign
may contain several mediaplans but a mediaplan belongs to only one
campaign). Here is an extract from my ejb-jar:

        <relationships>
                <ejb-relation>
                 <ejb-relation-name>MediaPlan-Campaign</ejb-relation-name>
                     <ejb-relationship-role>
                                    <ejb-relationship-role-name>
                                            campaign-has-mediaplan
                                    </ejb-relationship-role-name>
                                    <multiplicity>many</multiplicity>
                                    <role-source>
                                            <ejb-name>Campaign</ejb-name>
                                    </role-source>
                                    <cmr-field>
<cmr-field-name>mediaplans</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
                                    </cmr-field>
                        </ejb-relationship-role>
                        <ejb-relationship-role>
                                    <ejb-relationship-role-name>
                                            mediaplan_belongsto_campaign
                                    </ejb-relationship-role-name>
                                    <multiplicity>one</multiplicity>
                                    <cmr-field>
<cmr-field-name>campaign</cmr-field-name>
                                    </cmr-field>
                                    <role-source>
                                            <ejb-name>MediaPlan</ejb-name>
                                    </role-source>
                        </ejb-relationship-role>
                </ejb-relation>
        </relationships>

Now when orion deploys it creates table that are IMHO uncessarly complex:

Auto-creating table: create table Campaign (id NUMBER not null primary
key, name VARCHAR2(255) null, creation_date DATE null, start_date DATE
null)

Auto-creating table: create table Campaign_mediaplans (id NUMBER not null,
value NUMBER null)

Auto-creating table: create table MediaPlan (mediaplanid NUMBER not null
primary key, name VARCHAR2(255) null, descr VARCHAR2(255) null, campaign
NUMBER null)

The join table Campaign_mediaplans is not necessary ...

then when I create a new mediaplan with campaign = 1 for example, it
works. But if I load the bean Campaign = 1 and I ask for the list of media
plans, the result is empty ... The table Campaign_mediaplans is empty
after the beans creation.

I'm not sure if I'm wrong or if it's an Orion problem, the EJB 2 draft is
not very clear to me.

Thanks.

--
Yann Doussot <[EMAIL PROTECTED]>
Grey Interactive - France - http://www.gifrance.com/



Reply via email to