I had the same idea a few weeks ago. But my idea was not only to allow using foreign key but to create directly a "BaseObjectProperty" which would be represented by a foreign key in the DB but which would be mapped in HQL as a BaseObject... Something like: "select obj.linkedobj from BaseObject as obj"
This would be really really powerful... I have been linking 2 objects using a LongProperty to represent the foreign key but I can't write direct HQL requests... regards Pascal On Thu, Oct 23, 2008 at 5:11 PM, Thomas McColgan < [EMAIL PROTECTED]> wrote: > I'm proposing to implement a new property type: A foreign key, > analogous to the concept in relational databases. Together with custom > mapping, a property like this would make it possible to use Xwiki as a > frontend for a relational database, while making full use of the wikis > capabilities(configurability, history, etc). > The implementation would look similar to the existing "Database list" > on the outside, but it would make a lot more use of the databases > features. If A links to B, and someone deletes B the reference in A > would either be set to null, or the delete would be stopped, depending > on the configuration. It would also make it possible to adress > associated objects directly in hql. > > The basic functionality can be emulated using DBList(adding a property > to one object by choosing from existing instances of another class), > but this is not useful if one wants to have "real" foreign key > behaviour in the wiki and the underlying DB. If there is a demand for > this I will be happy to contribute a patch once I am done, and I will > try make the code nice enough to submit. Otherwise I will probably > just make it as a hack to meet the exact need that I have... > > Thomas > _______________________________________________ > devs mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/devs > _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

