Associations between classes

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Associations between classes

Yves Langisch
Hi

I'm looking for a way to define some kind of associations between
classes. Let me explain by an example what I mean exactly:

I want to collect structured data for countries and its regions. To
achieve this I define to classes, CountryClass and a RegionClass (incl.
the sheets and templates). Now the user should be able to create new
country objects _and_ he should have the possibility (in the form
itself) to define which regions belong to a country.

I tried to achieve this by adding a database list property to the
country class with an appropriate hibernate query which selects all
region documents. This let the user select one or more regions for a
country. This is fine so far but

- Is there any more general or a better way to achieve this associations
(e.g. without hibernate queries)?
- How can I adapt my ClassSheet so that the selected region associations
are hyperlinked to the appropriate region objects?

Thanks
Yves






--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Associations between classes

Ludovic Dubost

Hi Yves,

I believe you should do it the other way around.. A region belongs to
one and only one country so it is better to add a country field which
his a mono-select from the list of countries..

What you then need to do is add in the Country page a nice zone where
you list the region belonging to that country and add a nice form field
allowing to add a new region..

Since people will need to create structured data for region they can
choose the country at the same time..

Ludovic

Yves Langisch wrote:

> Hi
>
> I'm looking for a way to define some kind of associations between
> classes. Let me explain by an example what I mean exactly:
>
> I want to collect structured data for countries and its regions. To
> achieve this I define to classes, CountryClass and a RegionClass (incl.
> the sheets and templates). Now the user should be able to create new
> country objects _and_ he should have the possibility (in the form
> itself) to define which regions belong to a country.
>
> I tried to achieve this by adding a database list property to the
> country class with an appropriate hibernate query which selects all
> region documents. This let the user select one or more regions for a
> country. This is fine so far but
>
> - Is there any more general or a better way to achieve this associations
> (e.g. without hibernate queries)?
> - How can I adapt my ClassSheet so that the selected region associations
> are hyperlinked to the appropriate region objects?
>
> Thanks
> Yves
>
>
>
>
>  
> ------------------------------------------------------------------------
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>  

--
Ludovic Dubost
XPertNet: http://www.xpertnet.fr/
Blog: http://www.ludovic.org/blog/
XWiki: http://www.xwiki.com
Skype: ldubost AIM: nvludo Yahoo: ludovic




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws