Just for information,
you can "simulate" a ONE2MANY relation with dblists.
As far as I can remember (I don't have my XWiki in front of me):
you create a class CompanyClass with a field that you will manage by
yourself as a unique primary key. For example the property "name" of the
company. Each company has a different name.

Then you create a class PersonClass with a DBStringList property called
"company" and in the form, you set XWikiClass to "CompanyClass" and property
to "name" and you set the way to choose the company to "select".

Then you create some CompanyClass Objects.
So when you create a new PersonClass Object, in the inline editor, you
should see a list with all the companies names you created. In fact, XWiki
performs a HQL request to retrieve a list of the "name" properties for all
CompanyClass objects.

It is not a real DB relation as you can imagine in hibernate because there
is no physical relationship between 2 table Person and Company. So if a
Person has a company property set to a given value and then you change this
Company object property "name", the Person is not aware about it and will
keep the former name.
Anyway, this is quite practical in most cases.

You can even manage multiple values with a separator.
I use it intensively on my side and I love it :)

Pascal

On Fri, Dec 18, 2009 at 10:49 AM, Helenc <[email protected]> wrote:

>
> Hi All,
>
> I would really like to be able to mimic one to many relations through
> classes somehow?
>
> I noticed there have been a few posts about how one might go about such a
> thing using dblists, it's not clear yet to me how I could implement such a
> thing? I'm wondering if any demo application exist that might give me more
> of a clue?
>
> Let's say I want to set up a simple one to many relationship between
> information about a company and then individuals who worked for that
> company. How would I go about such a thing?
>
> Do I setup a companyclass and a personsclass and then link them somehow
> with
> the dblist?
>
> What's the best user interface setup for this too so it's easy for users to
> enter company and people data?
>
> Are there any examples of HQL queries about how one would then search to
> display individuals details along with elements of their companies details?
> Referencing the relationship?
>
> Or is there another way to do this? Any pointers would be very much
> appreciated?
>
> Thanks
> Helen
>
>
>
> --
> View this message in context:
> http://n2.nabble.com/mimic-relational-database-one-to-many-relations-tp4185725p4185725.html
> Sent from the XWiki- Dev mailing list archive at Nabble.com.
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
>
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to