Highlighted

Hierarchical data with SQLAssembler: pointers vs ids

Avatar

Guest

07-07-2008

Hi!



Ive got parent-children nodes that I need to store and retrieve from an SQL database, using SQLAssembler. The parents and children are a recursive tree, all of the same class.



The data is displayed in AdvancedDataGrid, which requires the children attribute. In the SQL table, I prefer one parent relation instead. Therefore my model uses both, which increases the complexity.



My problem, I think, is that the Flex/ActionScript model is using pointers (parent), while the SQL tables uses the parentId (integer).



How do I deal with the two different ways of referring to the parent/child? Do I need to implement both in my managed objects?



------------

My current implementation includes both SQL ids and AS pointers. On the result event, I create pointer relationships based on the SQL node ids. I think this may be unnecessary, as LCDS is passing the whole tree as one, to the database after my update.



I basically unsure how to implement these parent/child relationships in ActionScript and/or SQL tables / statements. Because my current implemnations have been mucking up halfway through.



Any hints are greatly appreciated.



Cheers,

Vegard