On Wednesday 16 July 2003 11:38 pm, Johan Carlsson wrote:
Norman Khine wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi, I am trying to get my head arround on how to build a registration form, that has a one-to-many relationship. Basically, what I am trying to do is to have two "tables" one listing business_addresses and on the other "table" to list all emplolyees for that business, thus creating a one-to-many relation between the business_address object and the employees.
If anyone can point me on how to achieve this, I'll be most greatfull
Here's my 25 cents:
Can't you just use a list in the "one" object with referense by object paths to the "many" objects.
You might also need an API that can fetch the related object, add and remove related objects and a mechanism that updates the object paths if the objects are moved.
If you are working at the python product level you can also store a direct reference to the other object so long as it is a persistent object. That works very well also but for safety I also have mine store information necessary to get that link back if it gets data back that it does not expect. It works very well in my experience so far and has allowed me to cut db size a lot since you can use it to implement shared objects. This method is nice in that it works transparently for people used to python since you just access the object normally. If you have an error condition you then handle that.