[storm] Circular reference in defining References.

Mac Ryan quasipedia at gmail.com
Tue Sep 1 13:14:48 BST 2009


Hello,

	I'm experiencing some troubles in defining a Reference from a table to
another and - simultaneously - a ReferenceSet for the other way around
relationship.

	Using the terminology and examples from the tutorial for clarity, the
problem is that I cannot include line #1 in the Employee class
definition unless I have previously defined the class "Company", but I
can't include #2 in the Company class definition unless I have defined
the class "Employee" first.

1. Employee.company = Reference(Employee.company_id, Company.id)
2. Company.employees = ReferenceSet(Company.id, Employee.company_id)

Working around this is quite easy (wrapping #1 and #2 into their
respective __init__ methods, for example), but I would like a word of
advice on what is the most elegant and clean solution, as each work
around has its downsides.

Many thanks in advance,
Mac.




More information about the storm mailing list