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 Rémi Bars <rb...@softeam.fr> on 2003/11/13 17:54:59 UTC

Mapping association in one table

Hi all,

in my application i have an association between 2 objects A and B. i want to
store the items of B in the A table ,  is it possible? how can i do that
with the odmg api, how can i map that in the repository?is it a stupid
question?

Sample :
class A {
    int id
    B firstB;
    B secondB
}
class B {
    string string1;
    string string2;
}

create table A(id int primary key not null, firstB_string1 varchar(20),
firstB_string2 varchar(20),secondB_string1 varchar(20),secondB_string2
varchar(20))

thank

Remi


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


Re: Mapping association in one table

Posted by Rémi Bars <rb...@softeam.fr>.
Thank  it works fine

remi
----- Original Message ----- 
From: "Nick Ohanian" <ni...@imagenmultimedia.com>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Thursday, November 13, 2003 7:36 PM
Subject: Re: Mapping association in one table


> Hi-
>
> I'm a little new at OJB, but I think it's possible.  Take a look at the
> section on nested objects at
> http://db.apache.org/ojb/tutorial3.html#nested%20objects, specifically
> the class-descriptor listed in that section.
>
> Your repository.xml should something like
>
> <class-descriptor class="A" table="A">
> ....
> <field-descriptor
>   name="firstB::string1"
>   column="firstB_string1"
> />
> <field-descriptor
>   name="firstB::string2"
>   column="firstB_string2"
> />
> <field-descriptor
>   name="secondB::string1"
>   column="secondB_string1"
> />
> <field-descriptor
>   name="secondB::string2"
>   column="secondB_string2"
> />
> </class-descriptor>
>
> Hope that helps.
>
> -Nick
>
>
>
> On Thu, 2003-11-13 at 08:54, Rémi Bars wrote:
> > Hi all,
> >
> > in my application i have an association between 2 objects A and B. i
want to
> > store the items of B in the A table ,  is it possible? how can i do that
> > with the odmg api, how can i map that in the repository?is it a stupid
> > question?
> >
> > Sample :
> > class A {
> >     int id
> >     B firstB;
> >     B secondB
> > }
> > class B {
> >     string string1;
> >     string string2;
> > }
> >
> > create table A(id int primary key not null, firstB_string1 varchar(20),
> > firstB_string2 varchar(20),secondB_string1 varchar(20),secondB_string2
> > varchar(20))
> >
> > thank
> >
> > Remi
> >
> >
> > ---------------------------------------------------------------------
> > 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


Re: Mapping association in one table

Posted by Nick Ohanian <ni...@imagenmultimedia.com>.
Hi-

I'm a little new at OJB, but I think it's possible.  Take a look at the
section on nested objects at
http://db.apache.org/ojb/tutorial3.html#nested%20objects, specifically
the class-descriptor listed in that section.

Your repository.xml should something like

<class-descriptor class="A" table="A">
....
<field-descriptor
  name="firstB::string1"
  column="firstB_string1"
/>
<field-descriptor
  name="firstB::string2"
  column="firstB_string2"
/>
<field-descriptor
  name="secondB::string1"
  column="secondB_string1"
/>
<field-descriptor
  name="secondB::string2"
  column="secondB_string2"
/>
</class-descriptor>

Hope that helps.

-Nick



On Thu, 2003-11-13 at 08:54, Rémi Bars wrote:
> Hi all,
> 
> in my application i have an association between 2 objects A and B. i want to
> store the items of B in the A table ,  is it possible? how can i do that
> with the odmg api, how can i map that in the repository?is it a stupid
> question?
> 
> Sample :
> class A {
>     int id
>     B firstB;
>     B secondB
> }
> class B {
>     string string1;
>     string string2;
> }
> 
> create table A(id int primary key not null, firstB_string1 varchar(20),
> firstB_string2 varchar(20),secondB_string1 varchar(20),secondB_string2
> varchar(20))
> 
> thank
> 
> Remi
> 
> 
> ---------------------------------------------------------------------
> 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