Complex Fetching
Posted: Thu Jun 30, 2016 9:19 pm
I'm having difficulty performing the following.
My new strategy is to go through and manually define my relationships for each save and fetch that I want to do at my top most project level.
Example Code
With that mapping more rigidly defined I can start to perform fetch_by_id_with_relation. This seemed to be working way better. The XML I dumped out was also grossly larger though which concerned me. Low and behold I cannot recommit the xml to the db because my foreign key relationships keep squawking that their prerequisite objects didn't get inserted first. I thought that this method of defining the relationship map would allow me to specify the ordering of what goes first. What happened?
What does save_all_with_recursion really do? does it just follow all of the 1-n relationships it can? How does it know to avoid circular logic if not? So many questions...
Thanks in advance!
- Populate Project Hierarchy into Database
- Fetch Project Hierarchy from database
- Dump Database records
- Re-save Project Hierarchy to Database
My new strategy is to go through and manually define my relationships for each save and fetch that I want to do at my top most project level.
Example Code
- Code: Select all
QStringList r;
r << "Coefficients->Breakpoints"
<< "SystemParams"
<< "UserParams"
<< "DataTables"
<< "ChannelCategories"
<< "InstrumentationTypes"
<< "Triggers"
<< "SimDataIndex"
<< "FacilityChannels"
<< "ChannelLimits"
<< "LimitActions"
<< "ComponentSpecifications->PropertySchemaList->*"
<< "ComponentSpecifications->SubComponentSpecs"
<< "Components->SubComponents"
<< "Components->Properties"
<< "Components->ComponentChannels->Properties"
With that mapping more rigidly defined I can start to perform fetch_by_id_with_relation. This seemed to be working way better. The XML I dumped out was also grossly larger though which concerned me. Low and behold I cannot recommit the xml to the db because my foreign key relationships keep squawking that their prerequisite objects didn't get inserted first. I thought that this method of defining the relationship map would allow me to specify the ordering of what goes first. What happened?
What does save_all_with_recursion really do? does it just follow all of the 1-n relationships it can? How does it know to avoid circular logic if not? So many questions...
Thanks in advance!